opcions per amagar la pantalla de carrega

This commit is contained in:
2026-04-15 09:23:36 +02:00
parent 727e55af03
commit 9f22e1c58b
6 changed files with 71 additions and 9 deletions

View File

@@ -623,6 +623,21 @@ namespace Options {
}
}
// Carga opciones de la pantalla de carga desde YAML
void loadLoadingFromYaml(const fkyaml::node& yaml) {
if (!yaml.contains("loading")) { return; }
const auto& ld = yaml["loading"];
if (ld.contains("show")) {
try { loading.show = ld["show"].get_value<bool>(); } catch (...) { loading.show = Defaults::Loading::SHOW; }
}
if (ld.contains("show_resource_name")) {
try { loading.show_resource_name = ld["show_resource_name"].get_value<bool>(); } catch (...) { loading.show_resource_name = Defaults::Loading::SHOW_RESOURCE_NAME; }
}
if (ld.contains("wait_for_input")) {
try { loading.wait_for_input = ld["wait_for_input"].get_value<bool>(); } catch (...) { loading.wait_for_input = Defaults::Loading::WAIT_FOR_INPUT; }
}
}
// Establece la ruta del fichero de configuración
void setConfigFile(const std::string& path) {
config_file_path = path;
@@ -673,6 +688,7 @@ namespace Options {
loadPlayerConfigFromYaml(yaml);
loadKioskConfigFromYaml(yaml);
loadLocalizationFromYaml(yaml);
loadLoadingFromYaml(yaml);
std::cout << "Config file loaded successfully\n\n";
@@ -810,6 +826,14 @@ namespace Options {
file << "localization:\n";
file << " language: \"" << language << "\"\n";
// LOADING SCREEN
file << "\n";
file << "# LOADING SCREEN\n";
file << "loading:\n";
file << " show: " << (loading.show ? "true" : "false") << "\n";
file << " show_resource_name: " << (loading.show_resource_name ? "true" : "false") << "\n";
file << " wait_for_input: " << (loading.wait_for_input ? "true" : "false") << " # solo si show=true\n";
file.close();
std::cout << "Config file saved successfully\n\n";