El responsable de comprobar si se ha pulsado alguna tecla para cambiar el tamaño de la venta, el modo de pantalla completa o la activación de los shaders pasa a ser la clase screen

This commit is contained in:
2024-07-05 14:09:38 +02:00
parent 5e7212dfaa
commit 62f3c42e7b
14 changed files with 209 additions and 187 deletions

View File

@@ -67,6 +67,13 @@ Logo::~Logo()
delete eventHandler;
}
// Recarga todas las texturas
void Logo::reloadTextures()
{
jailTexture->reLoad();
sinceTexture->reLoad();
}
// Comprueba el manejador de eventos
void Logo::checkEvents()
{
@@ -79,6 +86,15 @@ void Logo::checkEvents()
section->name = SECTION_PROG_QUIT;
break;
}
// Comprueba si se ha cambiado el tamaño de la ventana
else if (eventHandler->type == SDL_WINDOWEVENT)
{
if (eventHandler->window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
{
reloadTextures();
}
}
}
}
@@ -87,22 +103,7 @@ void Logo::checkInput()
{
if (input->checkInput(input_exit, REPEAT_FALSE))
{
section->name = SECTION_PROG_TITLE;
}
else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
{
screen->switchVideoMode();
}
else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
{
screen->decWindowSize();
}
else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
{
screen->incWindowSize();
section->name = SECTION_PROG_QUIT;
}
else if (input->checkAnyInput())
@@ -110,6 +111,9 @@ void Logo::checkInput()
section->name = SECTION_PROG_TITLE;
section->subsection = SUBSECTION_TITLE_1;
}
// Comprueba el input para el resto de objetos
screen->checkInput();
}
// Gestiona el logo de JAILGAME
@@ -288,8 +292,9 @@ void Logo::run()
while (section->name == SECTION_PROG_LOGO)
{
checkInput();
update();
checkEvents();
checkEvents(); // Tiene que ir antes del render
render();
}
}