Afegida confirmació per eixir del joc

This commit is contained in:
2024-09-25 09:19:12 +02:00
parent 2f152915ed
commit 6ad1bca29f
14 changed files with 156 additions and 16 deletions

View File

@@ -327,8 +327,7 @@ void Instructions::checkInput()
// Comprueba si se sale con el teclado
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
{
section->name = SECTION_PROG_QUIT;
section->options = SECTION_OPTIONS_QUIT_NORMAL;
quit(SECTION_OPTIONS_QUIT_NORMAL);
return;
}
@@ -343,6 +342,13 @@ void Instructions::checkInput()
for (int i = 0; i < input->getNumControllers(); ++i)
{
// Comprueba si se sale con el mando
if (input->checkModInput(input_service, input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
{
quit(SECTION_OPTIONS_QUIT_SHUTDOWN);
return;
}
// Comprueba si se va a resetear el juego
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
{
@@ -377,3 +383,17 @@ void Instructions::run()
render();
}
}
// Termina
void Instructions::quit(int code)
{
if (screen->notificationsAreActive())
{
section->name = SECTION_PROG_QUIT;
section->options = code;
}
else
{
screen->showNotification("Torna a polsar per eixir");
}
}