This commit is contained in:
2024-09-16 22:21:57 +02:00
parent 80425a5ed0
commit 159a75a60e
12 changed files with 384 additions and 307 deletions

View File

@@ -1,5 +1,4 @@
#include "instructions.h"
#include "service.h"
#include <iostream>
// Constructor
@@ -325,36 +324,42 @@ void Instructions::checkEvents()
// Comprueba las entradas
void Instructions::checkInput()
{
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT))
// 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;
return;
}
else if (input->checkAnyButtonPressed())
// Comprueba si se ha pulsado cualquier botón (de los usados para jugar)
if (input->checkAnyButtonPressed())
{
JA_StopMusic();
section->name = SECTION_PROG_TITLE;
section->options = SECTION_OPTIONS_TITLE_1;
return;
}
// Comprueba el botón de SERVICE
switch (checkServiceButton(input))
for (int i = 0; i < input->getNumControllers(); ++i)
{
case SERVICE_RESET:
section->name = SECTION_PROG_LOGO;
screen->showNotification("Reset");
break;
// Comprueba si se va a resetear el juego
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
{
section->name = SECTION_PROG_LOGO;
screen->showNotification("Reset");
return;
}
case SERVICE_MUTE:
options->audio.sound.enabled = options->audio.music.enabled = !options->audio.music.enabled;
JA_EnableMusic(options->audio.music.enabled);
JA_EnableSound(options->audio.sound.enabled);
screen->showNotification("Audio " + boolToOnOff(options->audio.music.enabled));
break;
default:
break;
// Comprueba si se va a activar o desactivar el audio
if (input->checkModInput(input_service, input_mute, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
{
options->audio.sound.enabled = options->audio.music.enabled = !options->audio.music.enabled;
JA_EnableMusic(options->audio.music.enabled);
JA_EnableSound(options->audio.sound.enabled);
screen->showNotification("Audio " + boolToOnOff(options->audio.music.enabled));
return;
}
}
// Comprueba el input para el resto de objetos