20 lines
520 B
C++
20 lines
520 B
C++
#pragma once
|
|
#include <string>
|
|
#include <limits>
|
|
|
|
class ScoreManager {
|
|
public:
|
|
ScoreManager(const std::string& filename);
|
|
|
|
void incrementScore();
|
|
void resetScore();
|
|
void saveHighScore();
|
|
int getCurrentScore() const { return currentScore; }
|
|
int getHighScore() const { return (highScore == std::numeric_limits<int>::max()) ? 0 : highScore; }
|
|
|
|
private:
|
|
int currentScore = 0;
|
|
int highScore = std::numeric_limits<int>::max();
|
|
std::string highscoreFile;
|
|
void loadHighscore();
|
|
}; |