Nou engine de notificacions

This commit is contained in:
2025-02-27 19:03:57 +01:00
parent 2e11fec2cb
commit 59e766f5c3
9 changed files with 122 additions and 67 deletions

View File

@@ -9,7 +9,22 @@
namespace globalInputs
{
// Cambia la paleta
void quit()
{
const std::string code = options.section.section == Section::GAME ? "PRESS AGAIN TO RETURN TO MENU" : "PRESS AGAIN TO EXIT";
auto code_found = stringInVector(Notifier::get()->getCodes(), code);
if (code_found)
{
// Si la notificación de salir está activa, cambia de sección
options.section.section = options.section.section == Section::GAME ? Section::TITLE : Section::QUIT;
}
else
{
// Si la notificación de salir no está activa, muestra la notificación
Notifier::get()->show({code}, NotificationText::CENTER, -1, true, code);
}
}
// Cambia la paleta de colores
void switchPalette()
{
options.video.palette = options.video.palette == Palette::ZXSPECTRUM ? Palette::ZXARNE : Palette::ZXSPECTRUM;
@@ -41,7 +56,7 @@ namespace globalInputs
{
if (Input::get()->checkInput(input_exit, REPEAT_FALSE))
{
options.section.section = Section::QUIT;
quit();
}
else if (Input::get()->checkInput(input_accept, REPEAT_FALSE))
@@ -52,32 +67,37 @@ namespace globalInputs
else if (Input::get()->checkInput(input_toggle_border, REPEAT_FALSE))
{
Screen::get()->toggleBorder();
Notifier::get()->show({"BORDER " + std::string(options.video.border.enabled ? "ENABLED" : "DISABLED")}, NotificationText::CENTER);
}
else if (Input::get()->checkInput(input_toggle_videomode, REPEAT_FALSE))
{
Screen::get()->toggleVideoMode();
Notifier::get()->show({"FULLSCREEN " + std::string(options.video.mode == 0 ? "DISABLED" : "ENABLED")}, NotificationText::CENTER);
}
else if (Input::get()->checkInput(input_window_dec_size, REPEAT_FALSE))
{
Screen::get()->decWindowZoom();
Notifier::get()->show({"WINDOW ZOOM x" + std::to_string(options.window.zoom)}, NotificationText::CENTER);
}
else if (Input::get()->checkInput(input_window_inc_size, REPEAT_FALSE))
{
Screen::get()->incWindowZoom();
Notifier::get()->show({"WINDOW ZOOM x" + std::to_string(options.window.zoom)}, NotificationText::CENTER);
}
else if (Input::get()->checkInput(input_toggle_shaders, REPEAT_FALSE))
{
Screen::get()->toggleShaders();
Notifier::get()->show({"HOLA"});
Notifier::get()->show({"SHADERS " + std::string(options.video.shaders ? "ENABLED" : "DISABLED")}, NotificationText::CENTER);
}
else if (Input::get()->checkInput(input_toggle_palette, REPEAT_FALSE))
{
switchPalette();
Notifier::get()->show({"PALETTE " + std::string(options.video.palette == Palette::ZXSPECTRUM ? "ZX SPECTRUM" : "ZX ARNE")}, NotificationText::CENTER);
}
}
}