El juego ya no se cierra al terminar de definir los botones
This commit is contained in:
@@ -36,7 +36,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
||||
gameLogo = new GameLogo(renderer, screen, asset, param, GAMECANVAS_CENTER_X, GAMECANVAS_FIRST_QUARTER_Y + 20);
|
||||
gameLogo->enable();
|
||||
|
||||
defineButtons = new DefineButtons(renderer, input, text2, param, options);
|
||||
defineButtons = new DefineButtons(renderer, input, text2, param, options, section);
|
||||
|
||||
// Inicializa los valores
|
||||
init();
|
||||
@@ -220,10 +220,22 @@ void Title::checkEvents()
|
||||
break;
|
||||
}
|
||||
|
||||
// Recarga las texturas
|
||||
else if (eventHandler->type == SDL_RENDER_DEVICE_RESET || eventHandler->type == SDL_RENDER_TARGETS_RESET)
|
||||
{
|
||||
reLoadTextures();
|
||||
}
|
||||
|
||||
// Comprueba en el primer mando el botón de salir del programa
|
||||
else if (eventHandler->type == SDL_CONTROLLERBUTTONDOWN)
|
||||
{
|
||||
if ((SDL_GameControllerButton)eventHandler->cbutton.which == 0)
|
||||
if ((SDL_GameControllerButton)eventHandler->cbutton.button == input->getControllerBinding(0, input_exit))
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -241,17 +253,14 @@ void Title::checkInput()
|
||||
fade->activate();
|
||||
postFade = index;
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba el teclado para salir
|
||||
if (input->checkInput(input_exit, DO_NOT_ALLOW_REPEAT))
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
}
|
||||
// Comprueba el teclado para salir
|
||||
if (input->checkInput(input_exit, DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
}
|
||||
|
||||
// Comprueba si se ha pulsado la tecla 1 o 2 para definir los controladores
|
||||
if (!defineButtons->isEnabled())
|
||||
{
|
||||
// Comprueba si se ha pulsado la tecla 1 o 2 para definir los controladores
|
||||
const Uint8 *keyStates = SDL_GetKeyboardState(nullptr);
|
||||
|
||||
if (keyStates[SDL_SCANCODE_1] != 0)
|
||||
|
||||
Reference in New Issue
Block a user