Updated game structure
Some checks failed
Build and Package Tetris / build-windows (push) Has been cancelled
Build and Package Tetris / build-linux (push) Has been cancelled

This commit is contained in:
2025-08-16 12:10:19 +02:00
parent 71648fbaeb
commit 2afaea7fd3
36 changed files with 665 additions and 382 deletions

20
src/persistence/Scores.h Normal file
View File

@ -0,0 +1,20 @@
// 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
};