El juego ya no se cierra al terminar de definir los botones

This commit is contained in:
2024-07-08 11:59:56 +02:00
parent dfc14da179
commit e85d3c2494
6 changed files with 36 additions and 23 deletions

View File

@@ -1,7 +1,7 @@
#include "define_buttons.h"
// Constructor
DefineButtons::DefineButtons(SDL_Renderer *renderer, Input *input, Text *text, param_t *param, options_t *options)
DefineButtons::DefineButtons(SDL_Renderer *renderer, Input *input, Text *text, param_t *param, options_t *options, section_t *section)
{
// Copia punteros a los objetos
this->renderer = renderer;
@@ -9,6 +9,7 @@ DefineButtons::DefineButtons(SDL_Renderer *renderer, Input *input, Text *text, p
this->text = text;
this->param = param;
this->options = options;
this->section = section;
// Inicializa variables
enabled = false;
@@ -109,6 +110,13 @@ void DefineButtons::checkInput()
// Comprueba los eventos que hay en la cola
while (SDL_PollEvent(&event))
{
// Evento de salida de la aplicación
if (event.type == SDL_QUIT)
{
section->name = SECTION_PROG_QUIT;
break;
}
if (event.type == SDL_CONTROLLERBUTTONDOWN)
doControllerButtonDown(&event.cbutton);
}
@@ -143,7 +151,7 @@ void DefineButtons::incIndexButton()
// Guarda los cambios en las opciones
saveBindingsToOptions();
//input->allActive(indexController);
input->allActive(indexController);
// Reinicia variables
indexButton = 0;