Añadido botón de servicio al titulo

This commit is contained in:
2024-09-09 13:31:37 +02:00
parent 7e1085ea42
commit 1b2d1c5786
6 changed files with 65 additions and 34 deletions

View File

@@ -221,15 +221,15 @@ void Title::checkEvents()
}
// 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;
}
}
// 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;
// }
//}
}
}
}
@@ -240,16 +240,9 @@ void Title::checkInput()
// Comprueba los controladores solo si no se estan definiendo los botones
if (!defineButtons->isEnabled())
{
// Comprueba si se ha pulsado algún botón para empezar a jugar
const int index = input->checkAnyButtonPressed();
if (index)
{
if (section->subsection == SUBSECTION_TITLE_2 || ALLOW_TITLE_ANIMATION_SKIP)
{ // No se puede empezar a jugar durante la animación del titulo a menos que se permita
fade->activate();
postFade = index;
}
}
//////////////////////////////////////////////////
// TECLADO //
//////////////////////////////////////////////////
// Comprueba el teclado para salir
if (input->checkInput(input_exit, DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
@@ -269,6 +262,42 @@ void Title::checkInput()
{
defineButtons->enable(1);
}
//////////////////////////////////////////////////
// MANDO //
//////////////////////////////////////////////////
// Comprueba el botón de SERVICE
switch (checkServiceButton(input, 0))
{
case SERVICE_EXIT:
section->name = SECTION_PROG_QUIT;
break;
case SERVICE_SHADERS:
screen->switchShaders();
break;
case SERVICE_CONFIG:
defineButtons->enable(0);
break;
default:
break;
}
// Comprueba el botón de START
for (int i = 0; i < input->getNumControllers(); ++i)
{
if (input->checkInput(input_start, false, INPUT_USE_GAMECONTROLLER, i))
{
if (section->subsection == SUBSECTION_TITLE_2 || ALLOW_TITLE_ANIMATION_SKIP)
{
fade->activate();
postFade = i + 1;
}
}
}
}
// Comprueba el input para el resto de objetos