Ya funcionan los nuevos inputs de teclado y mando durante la tabla de records

This commit is contained in:
2023-02-12 19:24:45 +01:00
parent b8bb1b144f
commit c4eaeefb13
3 changed files with 48 additions and 15 deletions

View File

@@ -5,12 +5,13 @@
const Uint8 SELF = 0;
// Constructor
HiScoreTable::HiScoreTable(SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lang, options_t *options)
HiScoreTable::HiScoreTable(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, options_t *options)
{
// Copia los punteros
this->renderer = renderer;
this->screen = screen;
this->asset = asset;
this->input = input;
this->lang = lang;
// Reserva memoria para los punteros
@@ -52,6 +53,9 @@ void HiScoreTable::update()
// Comprueba los eventos
checkEventHandler();
// Comprueba las entradas
checkInput();
// Actualiza las variables
if (SDL_GetTicks() - ticks > ticksSpeed)
{
@@ -178,21 +182,45 @@ void HiScoreTable::checkEventHandler()
section.name = PROG_SECTION_QUIT;
break;
}
}
}
if ((eventHandler->type == SDL_KEYUP) || (eventHandler->type == SDL_JOYBUTTONUP))
// Comprueba las entradas
void HiScoreTable::checkInput()
{
if (input->checkInput(input_exit, REPEAT_FALSE))
{
section.name = PROG_SECTION_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))
{
if (mode == mhst_auto)
{
if (mode == mhst_auto)
JA_StopMusic();
section.name = PROG_SECTION_TITLE;
section.subsection = TITLE_SECTION_1;
}
else
{
if (counter > 30)
{
JA_StopMusic();
section.name = PROG_SECTION_TITLE;
section.subsection = TITLE_SECTION_1;
}
else
{
if (counter > 30)
{
manualQuit = true;
}
manualQuit = true;
}
}
}