afegida estructura per al modo quiosco

This commit is contained in:
2026-03-08 08:57:04 +01:00
parent 723ab3d800
commit a8240a5d82
4 changed files with 56 additions and 0 deletions

View File

@@ -454,6 +454,37 @@ void loadGamepadControlsFromYaml(const fkyaml::node& yaml) {
}
}
// Carga configuración del modo kiosko desde YAML
void loadKioskConfigFromYaml(const fkyaml::node& yaml) {
if (yaml.contains("kiosk")) {
const auto& k = yaml["kiosk"];
if (k.contains("enabled")) {
try {
kiosk.enabled = k["enabled"].get_value<bool>();
} catch (...) {
kiosk.enabled = Defaults::Kiosk::ENABLED;
}
}
if (k.contains("text")) {
try {
kiosk.text = k["text"].get_value<std::string>();
} catch (...) {
kiosk.text = Defaults::Kiosk::TEXT;
}
}
if (k.contains("infinite_lives")) {
try {
kiosk.infinite_lives = k["infinite_lives"].get_value<bool>();
} catch (...) {
kiosk.infinite_lives = Defaults::Kiosk::INFINITE_LIVES;
}
}
}
}
// Crea e inicializa las opciones del programa
void init() {
#ifdef _DEBUG
@@ -516,6 +547,7 @@ auto loadFromFile() -> bool {
loadVideoConfigFromYaml(yaml);
loadKeyboardControlsFromYaml(yaml);
loadGamepadControlsFromYaml(yaml);
loadKioskConfigFromYaml(yaml);
if (console) {
std::cout << "Config file loaded successfully\n\n";
@@ -598,6 +630,14 @@ auto saveToFile() -> bool {
file << " button_right: " << gamepadButtonToString(gamepad_controls.button_right) << "\n";
file << " button_jump: " << gamepadButtonToString(gamepad_controls.button_jump) << "\n";
// KIOSK
file << "\n";
file << "# KIOSK MODE\n";
file << "kiosk:\n";
file << " enabled: " << (kiosk.enabled ? "true" : "false") << "\n";
file << " text: \"" << kiosk.text << "\"\n";
file << " infinite_lives: " << (kiosk.infinite_lives ? "true" : "false") << "\n";
file.close();
if (console) {