fix: al voler definir els botons dels mandos sense tindre cap mando conectat, petava tot

This commit is contained in:
2024-07-26 11:58:03 +02:00
parent 1632441c31
commit 5e5d7f5f27
3 changed files with 14 additions and 11 deletions

View File

@@ -111,11 +111,11 @@ void DefineButtons::checkInput()
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_QUIT)
{
section->name = SECTION_PROG_QUIT;
break;
}
if (event.type == SDL_CONTROLLERBUTTONDOWN)
doControllerButtonDown(&event.cbutton);
@@ -126,9 +126,12 @@ void DefineButtons::checkInput()
// Habilita el objeto
void DefineButtons::enable(int index)
{
enabled = true;
indexController = index;
indexButton = 0;
if (input->getNumControllers() > 0)
{
enabled = true;
indexController = index;
indexButton = 0;
}
}
// Comprueba si está habilitado