Afegit global_inputs.c

El audio no es podía mutejar amb el teclat, soles amb els mandos
This commit is contained in:
2024-09-28 17:08:09 +02:00
parent 289d01b0fa
commit 4febe8b7c0
11 changed files with 112 additions and 301 deletions

View File

@@ -1,6 +1,7 @@
#include "instructions.h"
#include "param.h"
#include "options.h"
#include "global_inputs.h"
#include <iostream>
// Constructor
@@ -322,21 +323,6 @@ void Instructions::checkEvents()
// Comprueba las entradas
void Instructions::checkInput()
{
// Comprueba si se sale con el teclado
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
{
quit(section::OPTIONS_QUIT_NORMAL);
return;
}
// Comprueba si se va a resetear el juego
if (input->checkInput(input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
{
section::name = section::NAME_INIT;
screen->showNotification("Reset");
return;
}
// Comprueba si se ha pulsado cualquier botón (de los usados para jugar)
if (input->checkAnyButtonPressed())
{
@@ -346,36 +332,11 @@ void Instructions::checkInput()
return;
}
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))
{
section::name = section::NAME_LOGO;
screen->showNotification("Reset");
return;
}
// 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
screen->checkInput();
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
checkGlobalInputs();
}
// Bucle para la pantalla de instrucciones
@@ -388,18 +349,4 @@ void Instructions::run()
checkEvents(); // Tiene que ir antes del render
render();
}
}
// Termina
void Instructions::quit(section::options_e code)
{
if (screen->notificationsAreActive())
{
section::name = section::NAME_QUIT;
section::options = code;
}
else
{
screen->showNotification(lang::getText(94));
}
}