26 lines
581 B
C++
26 lines
581 B
C++
#pragma once
|
|
#include <string>
|
|
#include <limits>
|
|
|
|
class ScoreManager {
|
|
public:
|
|
ScoreManager(const std::string& filename);
|
|
|
|
void incrementScore();
|
|
void resetScore();
|
|
void saveHighScore(int finalScore, double finalTime);
|
|
|
|
int getCurrentScore() const { return currentScore; }
|
|
int getHighScore() const { return highScore; }
|
|
double getBestTime() const { return bestTime; }
|
|
|
|
private:
|
|
int currentScore = 0;
|
|
int highScore = std::numeric_limits<int>::max();
|
|
double bestTime = std::numeric_limits<double>::max();
|
|
|
|
std::string highscoreFile;
|
|
|
|
void loadHighscore();
|
|
};
|