canvi de pc (toquejant Options)

This commit is contained in:
2025-06-14 16:28:36 +02:00
parent 4b8cc67b5c
commit 23e8f90274
27 changed files with 505 additions and 454 deletions

View File

@@ -14,7 +14,7 @@
#include "service_menu.h" // Para ServiceMenu
#include "utils.h" // Para boolToOnOff
namespace globalInputs
namespace GlobalInputs
{
// Termina
void quit()
@@ -23,13 +23,13 @@ namespace globalInputs
if (Notifier::get()->checkCode(CODE))
{
// Si la notificación de salir está activa, cambia de sección
section::name = section::Name::QUIT;
section::options = section::Options::NONE;
Section::name = Section::Name::QUIT;
Section::options = Section::Options::NONE;
}
else
{
// Si la notificación de salir no está activa, muestra la notificación
Notifier::get()->show({lang::getText("[NOTIFICATIONS] 01"), std::string()}, -1, CODE);
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 01"), std::string()}, -1, CODE);
}
}
@@ -39,12 +39,12 @@ namespace globalInputs
const std::string CODE = "RESET";
if (Notifier::get()->checkCode(CODE))
{
section::name = section::Name::RESET;
Notifier::get()->show({lang::getText("[NOTIFICATIONS] 15")});
Section::name = Section::Name::RESET;
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 15")});
}
else
{
Notifier::get()->show({lang::getText("[NOTIFICATIONS] 03"), std::string()}, -1, CODE);
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 03"), std::string()}, -1, CODE);
}
}
@@ -60,32 +60,32 @@ namespace globalInputs
void toggleIntegerScale()
{
Screen::get()->toggleIntegerScale();
Notifier::get()->show({lang::getText("[NOTIFICATIONS] 12") + " " + boolToOnOff(options.video.integer_scale)});
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 12") + " " + boolToOnOff(options.video.integer_scale)});
}
// Activa / desactiva el vsync
void toggleVSync()
{
Screen::get()->toggleVSync();
Notifier::get()->show({lang::getText("[NOTIFICATIONS] 14") + " " + boolToOnOff(options.video.v_sync)});
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 14") + " " + boolToOnOff(options.video.v_sync)});
}
// Activa o desactiva los shaders
void toggleShaders()
{
Screen::get()->toggleShaders();
Notifier::get()->show({lang::getText("[NOTIFICATIONS] 13") + " " + boolToOnOff(options.video.shaders)});
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 13") + " " + boolToOnOff(options.video.shaders)});
}
// Obtiene una fichero a partir de un lang::Code
std::string getLangFile(lang::Code code)
std::string getLangFile(Lang::Code code)
{
switch (code)
{
case lang::Code::VALENCIAN:
case Lang::Code::VALENCIAN:
return Asset::get()->get("ba_BA.json");
break;
case lang::Code::SPANISH:
case Lang::Code::SPANISH:
return Asset::get()->get("es_ES.json");
break;
default:
@@ -95,14 +95,14 @@ namespace globalInputs
}
// Obtiene una cadena a partir de un lang::Code
std::string getLangName(lang::Code code)
std::string getLangName(Lang::Code code)
{
switch (code)
{
case lang::Code::VALENCIAN:
case Lang::Code::VALENCIAN:
return " \"ba_BA\"";
break;
case lang::Code::SPANISH:
case Lang::Code::SPANISH:
return " \"es_ES\"";
break;
default:
@@ -117,16 +117,16 @@ namespace globalInputs
const std::string CODE = "LANG";
if (Notifier::get()->checkCode(CODE))
{
options.game.language = lang::getNextLangCode(options.game.language);
lang::loadFromFile(getLangFile(static_cast<lang::Code>(options.game.language)));
section::name = section::Name::RESET;
section::options = section::Options::RELOAD;
Notifier::get()->show({lang::getText("[NOTIFICATIONS] 05") + getLangName(options.game.language)});
options.game.language = Lang::getNextLangCode(options.game.language);
Lang::loadFromFile(getLangFile(static_cast<Lang::Code>(options.game.language)));
Section::name = Section::Name::RESET;
Section::options = Section::Options::RELOAD;
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 05") + getLangName(options.game.language)});
}
else
{
const auto NEXT = lang::getNextLangCode(options.game.language);
Notifier::get()->show({lang::getText("[NOTIFICATIONS] 04") + getLangName(NEXT), std::string()}, -1, CODE);
const auto NEXT = Lang::getNextLangCode(options.game.language);
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 04") + getLangName(NEXT), std::string()}, -1, CODE);
}
}
@@ -134,24 +134,24 @@ namespace globalInputs
void toggleFireMode()
{
options.game.autofire = !options.game.autofire;
Notifier::get()->show({lang::getText("[NOTIFICATIONS] 08") + " " + boolToOnOff(options.game.autofire)});
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 08") + " " + boolToOnOff(options.game.autofire)});
}
// Salta una sección del juego
void skipSection()
{
switch (section::name)
switch (Section::name)
{
case section::Name::INTRO:
case Section::Name::INTRO:
Audio::get()->stopMusic();
/* Continua en el case de abajo */
case section::Name::LOGO:
case section::Name::HI_SCORE_TABLE:
case section::Name::INSTRUCTIONS:
case Section::Name::LOGO:
case Section::Name::HI_SCORE_TABLE:
case Section::Name::INSTRUCTIONS:
{
section::name = section::Name::TITLE;
section::options = section::Options::TITLE_1;
section::attract_mode = section::AttractMode::TITLE_TO_DEMO;
Section::name = Section::Name::TITLE;
Section::options = Section::Options::TITLE_1;
Section::attract_mode = Section::AttractMode::TITLE_TO_DEMO;
break;
}
default:
@@ -169,7 +169,7 @@ namespace globalInputs
void toggleFullscreen()
{
Screen::get()->toggleFullscreen();
const std::string MODE = options.video.fullscreen ? lang::getText("[NOTIFICATIONS] 11") : lang::getText("[NOTIFICATIONS] 10");
const std::string MODE = options.video.fullscreen ? Lang::getText("[NOTIFICATIONS] 11") : Lang::getText("[NOTIFICATIONS] 10");
Notifier::get()->show({MODE});
}
@@ -178,7 +178,7 @@ namespace globalInputs
{
if (Screen::get()->decWindowSize())
{
Notifier::get()->show({lang::getText("[NOTIFICATIONS] 09") + " x" + std::to_string(options.window.size)});
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 09") + " x" + std::to_string(options.window.size)});
}
}
@@ -187,7 +187,7 @@ namespace globalInputs
{
if (Screen::get()->incWindowSize())
{
Notifier::get()->show({lang::getText("[NOTIFICATIONS] 09") + " x" + std::to_string(options.window.size)});
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 09") + " x" + std::to_string(options.window.size)});
}
}
@@ -323,7 +323,7 @@ namespace globalInputs
if (Input::get()->checkInput(InputAction::WINDOW_FULLSCREEN, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::KEYBOARD))
{
Screen::get()->toggleFullscreen();
const std::string MODE = options.video.fullscreen ? lang::getText("[NOTIFICATIONS] 11") : lang::getText("[NOTIFICATIONS] 10");
const std::string MODE = options.video.fullscreen ? Lang::getText("[NOTIFICATIONS] 11") : Lang::getText("[NOTIFICATIONS] 10");
Notifier::get()->show({MODE});
return;
}
@@ -333,7 +333,7 @@ namespace globalInputs
{
if (Screen::get()->decWindowSize())
{
Notifier::get()->show({lang::getText("[NOTIFICATIONS] 09") + " x" + std::to_string(options.window.size)});
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 09") + " x" + std::to_string(options.window.size)});
}
return;
}
@@ -343,7 +343,7 @@ namespace globalInputs
{
if (Screen::get()->incWindowSize())
{
Notifier::get()->show({lang::getText("[NOTIFICATIONS] 09") + " x" + std::to_string(options.window.size)});
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 09") + " x" + std::to_string(options.window.size)});
}
return;
}