1 #ifndef CONFIG_H 2 #define CONFIG_H 3 4 #include <string> 5 6 7 // Store configuration 8 class Config { 9 static Config * singleton_; 10 11 enum { min_details = 0, max_details = 4 }; 12 int details_level_; 13 int refresh_rate_; 14 const std::string player_name_; 15 const std::string score_file_name_; 16 17 Config(); 18 Config(const Config&); // no copy 19 Config & operator=(const Config&); // no copy 20 public: 21 static Config & Instance(); DestroyInstance()22 static void DestroyInstance() { delete singleton_; singleton_ = 0; } 23 24 void AddDetailsLevel(int); ScaleDetails(int val)25 int ScaleDetails(int val) const 26 { return val * details_level_ / max_details; } MaxDetails()27 int MaxDetails() const { return max_details; } RefreshRate(void)28 int RefreshRate(void) const { return refresh_rate_; } 29 int NextRefreshRate(void) const; SetNextRefreshRate(void)30 void SetNextRefreshRate(void) { refresh_rate_ = NextRefreshRate(); } GetPlayerName()31 const std::string & GetPlayerName() const { return player_name_; } GetScoreFileName()32 const std::string & GetScoreFileName() const { return score_file_name_; } 33 }; 34 35 36 // Resize window to standard size, 0 has no effect. 37 void SetStandardWindowSize(unsigned win_size); 38 39 #endif 40