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

@@ -161,6 +161,13 @@ Intro::~Intro()
}
}
// Recarga todas las texturas
void Intro::reloadTextures()
{
texture->reLoad();
text->reLoadTexture();
}
// Comprueba los eventos
void Intro::checkEvents()
{
@@ -173,6 +180,15 @@ void Intro::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();
}
}
}
}
@@ -184,27 +200,15 @@ void Intro::checkInput()
section->name = SECTION_PROG_QUIT;
}
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();
}
else if (input->checkInput(input_pause, REPEAT_FALSE) || input->checkInput(input_accept, REPEAT_FALSE) || input->checkInput(input_fire_left, REPEAT_FALSE) || input->checkInput(input_fire_center, REPEAT_FALSE) || input->checkInput(input_fire_right, REPEAT_FALSE))
{
JA_StopMusic();
section->name = SECTION_PROG_TITLE;
section->subsection = SUBSECTION_TITLE_1;
}
// Comprueba el input para el resto de objetos
screen->checkInput();
}
// Actualiza las escenas de la intro
@@ -366,8 +370,6 @@ void Intro::updateScenes()
// Actualiza las variables del objeto
void Intro::update()
{
checkInput();
if (SDL_GetTicks() - ticks > ticksSpeed)
{
// Actualiza el contador de ticks
@@ -420,8 +422,9 @@ void Intro::run()
while (section->name == SECTION_PROG_INTRO)
{
checkInput();
update();
checkEvents();
checkEvents(); // Tiene que ir antes del render
render();
}
}