feat(config): persistència de les opcions d'àudio al config.yaml

This commit is contained in:
2026-05-24 18:40:33 +02:00
parent bacfbe6eac
commit 8c48a9a772
4 changed files with 68 additions and 7 deletions
+12
View File
@@ -299,6 +299,8 @@ namespace System {
.on_change = [](int) {
if (auto* a = Audio::get(); a != nullptr) {
a->toggleEnabled();
ConfigYaml::engine_config.audio.enabled = a->isEnabled();
ConfigYaml::saveToFile();
} },
},
// VOLUM GENERAL (master)
@@ -315,6 +317,8 @@ namespace System {
.on_change = [step_volume](int dir) {
if (auto* a = Audio::get(); a != nullptr) {
a->setMasterVolume(step_volume(a->getMasterVolume(), dir));
ConfigYaml::engine_config.audio.volume = a->getMasterVolume();
ConfigYaml::saveToFile();
} },
},
// MUSICA ON/OFF
@@ -330,6 +334,8 @@ namespace System {
.on_change = [](int) {
if (auto* a = Audio::get(); a != nullptr) {
a->toggleMusic();
ConfigYaml::engine_config.audio.music_enabled = a->isMusicEnabled();
ConfigYaml::saveToFile();
} },
},
// VOLUM MUSICA
@@ -346,6 +352,8 @@ namespace System {
.on_change = [step_volume](int dir) {
if (auto* a = Audio::get(); a != nullptr) {
a->setMusicVolume(step_volume(a->getMusicVolume(), dir));
ConfigYaml::engine_config.audio.music_volume = a->getMusicVolume();
ConfigYaml::saveToFile();
} },
},
// SONS ON/OFF
@@ -361,6 +369,8 @@ namespace System {
.on_change = [](int) {
if (auto* a = Audio::get(); a != nullptr) {
a->toggleSound();
ConfigYaml::engine_config.audio.sound_enabled = a->isSoundEnabled();
ConfigYaml::saveToFile();
} },
},
// VOLUM SONS
@@ -377,6 +387,8 @@ namespace System {
.on_change = [step_volume](int dir) {
if (auto* a = Audio::get(); a != nullptr) {
a->setSoundVolume(step_volume(a->getSoundVolume(), dir));
ConfigYaml::engine_config.audio.sound_volume = a->getSoundVolume();
ConfigYaml::saveToFile();
} },
},
};