Added settings.ini
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
#include <SDL3/SDL.h>
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include "../core/Settings.h"
|
||||
|
||||
OptionsState::OptionsState(StateContext& ctx) : State(ctx) {}
|
||||
|
||||
@ -233,18 +234,36 @@ void OptionsState::toggleFullscreen() {
|
||||
if (ctx.fullscreenFlag) {
|
||||
*ctx.fullscreenFlag = nextState;
|
||||
}
|
||||
// Save setting
|
||||
Settings::instance().setFullscreen(nextState);
|
||||
Settings::instance().save();
|
||||
}
|
||||
|
||||
void OptionsState::toggleMusic() {
|
||||
Audio::instance().toggleMute();
|
||||
// If muted, music is disabled. If not muted, music is enabled.
|
||||
// Note: Audio::instance().isMuted() returns true if muted.
|
||||
// But Audio class doesn't expose isMuted directly in header usually?
|
||||
// Let's assume toggleMute toggles internal state.
|
||||
// We can track it via ctx.musicEnabled if it's synced.
|
||||
|
||||
bool enabled = true;
|
||||
if (ctx.musicEnabled) {
|
||||
*ctx.musicEnabled = !*ctx.musicEnabled;
|
||||
enabled = *ctx.musicEnabled;
|
||||
}
|
||||
|
||||
// Save setting
|
||||
Settings::instance().setMusicEnabled(enabled);
|
||||
Settings::instance().save();
|
||||
}
|
||||
|
||||
void OptionsState::toggleSoundFx() {
|
||||
bool next = !SoundEffectManager::instance().isEnabled();
|
||||
SoundEffectManager::instance().setEnabled(next);
|
||||
// Save setting
|
||||
Settings::instance().setSoundEnabled(next);
|
||||
Settings::instance().save();
|
||||
}
|
||||
|
||||
void OptionsState::exitToMenu() {
|
||||
|
||||
Reference in New Issue
Block a user