Afegit globalEvents

This commit is contained in:
2025-02-23 09:53:06 +01:00
parent 8ae686a70b
commit 3ba4293e8a
16 changed files with 111 additions and 110 deletions

View File

@@ -17,6 +17,7 @@
#include "utils.h" // Para color_t, stringToColor, options_t
#include "options.h"
#include "global_inputs.h"
#include "global_events.h"
// Constructor
Title::Title()
@@ -105,13 +106,8 @@ void Title::checkEvents()
SDL_Event event;
while (SDL_PollEvent(&event))
{
// Evento de salida de la aplicación
if (event.type == SDL_QUIT)
{
options.section.name = SECTION_QUIT;
break;
}
globalEvents::check(event);
// Solo se comprueban estas teclas si no está activo el menu de logros
if (event.type == SDL_KEYDOWN)
{
@@ -149,62 +145,22 @@ void Title::checkInput()
{
moveCheevosList(0);
}
}
if (input_->checkInput(input_exit, REPEAT_FALSE))
{
if (show_cheevos_)
else if (input_->checkInput(input_accept, REPEAT_FALSE))
{
hideCheevosList();
counter_ = 0;
}
else
{
options.section.name = SECTION_QUIT;
}
}
else if (input_->checkInput(input_toggle_border, REPEAT_FALSE))
{
screen_->toggleBorder();
resource_->reLoadTextures();
}
else if (input_->checkInput(input_toggle_videomode, REPEAT_FALSE))
{
screen_->toggleVideoMode();
resource_->reLoadTextures();
}
else if (input_->checkInput(input_toggle_shaders, REPEAT_FALSE))
{
screen_->toggleShaders();
}
else if (input_->checkInput(input_window_dec_size, REPEAT_FALSE))
{
screen_->decWindowSize();
resource_->reLoadTextures();
}
else if (input_->checkInput(input_window_inc_size, REPEAT_FALSE))
{
screen_->incWindowSize();
resource_->reLoadTextures();
}
else if (input_->checkInput(input_toggle_palette, REPEAT_FALSE))
{
switchPalette();
}
else if (input_->checkInput(input_accept, REPEAT_FALSE) || input_->checkInput(input_pause, REPEAT_FALSE))
if (input_->checkInput(input_accept, REPEAT_FALSE))
{
if (state_ == show_loading_screen)
{
state_ = fade_loading_screen;
}
}
globalInputs::check();
}
// Actualiza la marquesina
@@ -462,7 +418,7 @@ void Title::createCheevosTexture()
SDL_RenderClear(renderer_);
// Escribe la lista de logros en la textura
const std::string cheevosOwner = "LOCAL ACHIEVEMENTS";
const std::string cheevosOwner = "ACHIEVEMENTS";
const std::string cheevosListCaption = cheevosOwner + " (" + std::to_string(Cheevos::get()->unlocked()) + " / " + std::to_string(Cheevos::get()->count()) + ")";
int pos = 2;
info_text_->writeDX(TXT_CENTER | TXT_COLOR, cheevos_texture_->getWidth() / 2, pos, cheevosListCaption, 1, stringToColor(options.palette, "bright_green"));