50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
#pragma once
|
|
#include <string>
|
|
|
|
/**
|
|
* Settings - Persistent game settings manager
|
|
* Handles loading/saving settings to settings.ini
|
|
*/
|
|
class Settings {
|
|
public:
|
|
// Singleton access
|
|
static Settings& instance();
|
|
|
|
// Load settings from file (returns true if file existed)
|
|
bool load();
|
|
|
|
// Save settings to file
|
|
bool save();
|
|
|
|
// Settings accessors
|
|
bool isFullscreen() const { return m_fullscreen; }
|
|
void setFullscreen(bool value) { m_fullscreen = value; }
|
|
|
|
bool isMusicEnabled() const { return m_musicEnabled; }
|
|
void setMusicEnabled(bool value) { m_musicEnabled = value; }
|
|
|
|
bool isSoundEnabled() const { return m_soundEnabled; }
|
|
void setSoundEnabled(bool value) { m_soundEnabled = value; }
|
|
|
|
bool isDebugEnabled() const { return m_debugEnabled; }
|
|
void setDebugEnabled(bool value) { m_debugEnabled = value; }
|
|
|
|
const std::string& getPlayerName() const { return m_playerName; }
|
|
void setPlayerName(const std::string& name) { m_playerName = name; }
|
|
|
|
// Get the settings file path
|
|
static std::string getSettingsPath();
|
|
|
|
private:
|
|
Settings(); // Private constructor for singleton
|
|
Settings(const Settings&) = delete;
|
|
Settings& operator=(const Settings&) = delete;
|
|
|
|
// Settings values
|
|
bool m_fullscreen = false;
|
|
bool m_musicEnabled = true;
|
|
bool m_soundEnabled = true;
|
|
bool m_debugEnabled = false;
|
|
std::string m_playerName = "Player";
|
|
};
|