La targeta d'ajuda ja ix amb els mandos i s'ha de deixar apretat el botó
This commit is contained in:
@@ -9,86 +9,129 @@
|
||||
#include "section.h" // for options_e, name, name_e, options
|
||||
#include "utils.h" // for op_audio_t, options_t, op_music_t, boolToOnOff
|
||||
|
||||
// Termina
|
||||
void quit(section::options_e code)
|
||||
namespace globalInputs
|
||||
{
|
||||
if (Screen::get()->notificationsAreActive())
|
||||
{
|
||||
section::name = section::NAME_QUIT;
|
||||
section::options = code;
|
||||
}
|
||||
else
|
||||
{
|
||||
Screen::get()->showNotification(lang::getText(94));
|
||||
}
|
||||
}
|
||||
// Variables
|
||||
std::vector<int> servicePressedCounter;
|
||||
|
||||
// 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))
|
||||
// Inicializa variables
|
||||
void init()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
else if (Input::get()->checkInput(input_service, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
OnScreenHelp::get()->toggleState();
|
||||
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))
|
||||
const int numInputs = Input::get()->getNumControllers() + 1;
|
||||
servicePressedCounter.reserve(numInputs);
|
||||
for (int i = 0; i < numInputs; ++i)
|
||||
{
|
||||
quit(section::OPTIONS_QUIT_SHUTDOWN);
|
||||
servicePressedCounter.push_back(0);
|
||||
}
|
||||
}
|
||||
|
||||
// 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 check()
|
||||
{
|
||||
// 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()->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
else if (Input::get()->checkInput(input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
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))
|
||||
else if (Input::get()->checkInput(input_mute, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
switchAudio();
|
||||
return;
|
||||
}
|
||||
|
||||
else if (Input::get()->checkInput(input_service, INPUT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
servicePressedCounter[0]++;
|
||||
|
||||
if (servicePressedCounter[0] == 3000)
|
||||
{
|
||||
OnScreenHelp::get()->toggleState();
|
||||
servicePressedCounter[0] = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
servicePressedCounter[0] = 0;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (Input::get()->checkInput(input_service, INPUT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
servicePressedCounter[i + 1]++;
|
||||
|
||||
if (servicePressedCounter[i + 1] == 3000)
|
||||
{
|
||||
OnScreenHelp::get()->toggleState();
|
||||
servicePressedCounter[i + 1] = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
servicePressedCounter[i + 1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user