Options: creat namespace

This commit is contained in:
2025-06-14 17:43:53 +02:00
parent 23e8f90274
commit c748070ba5
18 changed files with 542 additions and 544 deletions

View File

@@ -51,30 +51,30 @@ namespace GlobalInputs
// Activa o desactiva el audio
void toggleAudio()
{
options.audio.enabled = !options.audio.enabled;
Audio::get()->enable(options.audio.enabled);
Notifier::get()->show({"Audio " + boolToOnOff(options.audio.enabled)});
Options::audio.enabled = !Options::audio.enabled;
Audio::get()->enable(Options::audio.enabled);
Notifier::get()->show({"Audio " + boolToOnOff(Options::audio.enabled)});
}
// Cambia el modo de escalado entero
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
@@ -117,15 +117,15 @@ 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)));
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)});
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 05") + getLangName(Options::game.language)});
}
else
{
const auto NEXT = Lang::getNextLangCode(options.game.language);
const auto NEXT = Lang::getNextLangCode(Options::game.language);
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 04") + getLangName(NEXT), std::string()}, -1, CODE);
}
}
@@ -133,8 +133,8 @@ namespace GlobalInputs
// Cambia el modo de disparo
void toggleFireMode()
{
options.game.autofire = !options.game.autofire;
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 08") + " " + boolToOnOff(options.game.autofire)});
Options::game.autofire = !Options::game.autofire;
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 08") + " " + boolToOnOff(Options::game.autofire)});
}
// Salta una sección del juego
@@ -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;
}