Afegit global_inputs.c
El audio no es podía mutejar amb el teclat, soles amb els mandos
This commit is contained in:
84
source/global_inputs.cpp
Normal file
84
source/global_inputs.cpp
Normal file
@@ -0,0 +1,84 @@
|
||||
#include "global_inputs.h"
|
||||
#include "section.h"
|
||||
#include "screen.h"
|
||||
#include "input.h"
|
||||
#include "lang.h"
|
||||
#include "options.h"
|
||||
|
||||
// Termina
|
||||
void quit(section::options_e code)
|
||||
{
|
||||
if (Screen::get()->notificationsAreActive())
|
||||
{
|
||||
section::name = section::NAME_QUIT;
|
||||
section::options = code;
|
||||
}
|
||||
else
|
||||
{
|
||||
Screen::get()->showNotification(lang::getText(94));
|
||||
}
|
||||
}
|
||||
|
||||
// Reinicia
|
||||
void reset()
|
||||
{
|
||||
section::name = section::NAME_INIT;
|
||||
Screen::get()->showNotification("Reset");
|
||||
}
|
||||
|
||||
// Activa o desactiva el audio
|
||||
void switchAudio()
|
||||
{
|
||||
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::get()->showNotification("Audio " + boolToOnOff(options.audio.music.enabled));
|
||||
}
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
void checkGlobalInputs()
|
||||
{
|
||||
// Comprueba si se sale con el teclado
|
||||
if (Input::get()->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
|
||||
else if (Input::get()->checkInput(input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
else if (Input::get()->checkInput(input_mute, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
switchAudio();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < Input::get()->getNumControllers(); ++i)
|
||||
{
|
||||
// Comprueba si se sale con el mando
|
||||
if (Input::get()->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
|
||||
else if (Input::get()->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
// Comprueba si se va a activar o desactivar el audio
|
||||
else if (Input::get()->checkModInput(input_service, input_mute, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
switchAudio();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user