Files
spacetris/src/persistence/Scores.h
Gregor Klevze 2afaea7fd3
Some checks failed
Build and Package Tetris / build-windows (push) Has been cancelled
Build and Package Tetris / build-linux (push) Has been cancelled
Updated game structure
2025-08-16 12:10:19 +02:00

21 lines
661 B
C++

// Scores.h - High score persistence manager
#pragma once
#include <vector>
#include <string>
struct ScoreEntry { int score{}; int lines{}; int level{}; double timeSec{}; std::string name{"PLAYER"}; };
class ScoreManager {
public:
explicit ScoreManager(size_t maxScores = 12);
void load();
void save() const;
void submit(int score, int lines, int level, double timeSec);
const std::vector<ScoreEntry>& all() const { return scores; }
private:
std::vector<ScoreEntry> scores;
size_t maxEntries;
std::string filePath() const; // resolve path (SDL pref path or local)
void createSampleScores(); // create sample high scores
};