Demana confirmació per a canviar el idioma amb les tecles ràpides

Demana confirmació per reiniciar
This commit is contained in:
2025-03-10 21:22:32 +01:00
parent 79b2917112
commit 9c1b3c45b0
11 changed files with 92 additions and 38 deletions

View File

@@ -21,9 +21,8 @@ namespace globalInputs
// Termina
void quit(section::Options code)
{
const std::string exit_code = "QUIT";
auto code_found = stringInVector(Notifier::get()->getCodes(), exit_code);
if (code_found)
const std::string CODE = "QUIT";
if (Notifier::get()->checkCode(CODE))
{
// Si la notificación de salir está activa, cambia de sección
section::name = section::Name::QUIT;
@@ -33,10 +32,10 @@ namespace globalInputs
{
// Si la notificación de salir no está activa, muestra la notificación
#ifdef ARCADE
const int index = code == section::Options::QUIT_WITH_CONTROLLER ? 116 : 94;
Notifier::get()->showText({lang::getText(index), std::string()}, -1, exit_code);
const int INDEX = code == section::Options::QUIT_WITH_CONTROLLER ? 116 : 94;
Notifier::get()->showText({lang::getText(INDEX), std::string()}, -1, CODE);
#else
Notifier::get()->showText({lang::getText(94), std::string()}, -1, exit_code);
Notifier::get()->show({lang::getText(94), std::string()}, -1, CODE);
#endif
}
}
@@ -44,8 +43,16 @@ namespace globalInputs
// Reinicia
void reset()
{
section::name = section::Name::INIT;
Notifier::get()->showText({"Reset"});
const std::string CODE = "RESET";
if (Notifier::get()->checkCode(CODE))
{
section::name = section::Name::INIT;
Notifier::get()->show({"Reset"});
}
else
{
Notifier::get()->show({lang::getText(125), std::string()}, -1, CODE);
}
}
// Activa o desactiva el audio
@@ -62,7 +69,7 @@ namespace globalInputs
JA_SetMusicVolume(0);
JA_SetSoundVolume(0);
}
Notifier::get()->showText({"Audio " + boolToOnOff(options.audio.enabled)});
Notifier::get()->show({"Audio " + boolToOnOff(options.audio.enabled)});
}
// Obtiene una fichero a partir de un lang::Code
@@ -88,13 +95,13 @@ namespace globalInputs
switch (code)
{
case lang::Code::ba_BA:
return "ba_BA";
return " \"ba_BA\"";
break;
case lang::Code::es_ES:
return "es_ES";
return " \"es_ES\"";
break;
default:
return "en_UK";
return " \"en_UK\"";
break;
}
}
@@ -102,18 +109,27 @@ namespace globalInputs
// Cambia el idioma
void changeLang()
{
options.game.language = lang::change(options.game.language);
lang::loadFromFile(getLangFile(static_cast<lang::Code>(options.game.language)));
section::name = section::Name::INIT;
section::options = section::Options::RELOAD;
Notifier::get()->showText({getLangName(options.game.language)});
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::INIT;
section::options = section::Options::RELOAD;
Notifier::get()->show({lang::getText(127) + getLangName(options.game.language)});
}
else
{
const auto NEXT = lang::getNextLangCode(options.game.language);
Notifier::get()->show({lang::getText(126) + getLangName(NEXT), std::string()}, -1, CODE);
}
}
// Cambia el modo de disparo
void toggleFireMode()
{
options.game.autofire = !options.game.autofire;
Notifier::get()->showText({"Autofire " + boolToOnOff(options.game.autofire)});
Notifier::get()->show({"Autofire " + boolToOnOff(options.game.autofire)});
}
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
@@ -127,7 +143,7 @@ namespace globalInputs
{
Screen::get()->toggleVideoMode();
const std::string mode = options.video.mode == ScreenVideoMode::WINDOW ? "Window" : "Fullscreen";
Notifier::get()->showText({mode + " mode"});
Notifier::get()->show({mode + " mode"});
return;
}
@@ -136,7 +152,7 @@ namespace globalInputs
{
Screen::get()->decWindowSize();
const std::string size = std::to_string(options.video.window.size);
Notifier::get()->showText({"Window size x" + size});
Notifier::get()->show({"Window size x" + size});
return;
}
@@ -145,7 +161,7 @@ namespace globalInputs
{
Screen::get()->incWindowSize();
const std::string size = std::to_string(options.video.window.size);
Notifier::get()->showText({"Window size x" + size});
Notifier::get()->show({"Window size x" + size});
return;
}
#endif