La targeta d'ajuda ja ix amb els mandos i s'ha de deixar apretat el botó
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "asset.h" // for Asset, assetType
|
||||
#include "dbgtxt.h" // for dbg_init
|
||||
#include "game.h" // for Game, GAME_MODE_DEMO_OFF, GAME_...
|
||||
#include "global_inputs.h"
|
||||
#include "hiscore_table.h" // for HiScoreTable
|
||||
#include "input.h" // for inputs_e, Input
|
||||
#include "instructions.h" // for Instructions
|
||||
@@ -106,6 +107,8 @@ Director::Director(int argc, char *argv[])
|
||||
|
||||
// Carga las musicas del juego
|
||||
loadMusics();
|
||||
|
||||
globalInputs::init();
|
||||
}
|
||||
|
||||
Director::~Director()
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "enemy_formations.h" // for stage_t, EnemyFormations, enemyIni...
|
||||
#include "explosions.h" // for Explosions
|
||||
#include "fade.h" // for Fade, FADE_RANDOM_SQUARE, FADE_VEN...
|
||||
#include "global_inputs.h" // for checkGlobalInputs
|
||||
#include "global_inputs.h" // for globalInputs::check
|
||||
#include "input.h" // for inputs_e, Input, INPUT_DO_NOT_ALLO...
|
||||
#include "item.h" // for Item, ITEM_COFFEE_MACHINE, ITEM_CLOCK
|
||||
#include "jail_audio.h" // for JA_PlaySound, JA_DeleteSound, JA_L...
|
||||
@@ -2306,7 +2306,7 @@ void Game::checkInput()
|
||||
screen->checkInput();
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
checkGlobalInputs();
|
||||
globalInputs::check();
|
||||
}
|
||||
|
||||
// Pinta diferentes mensajes en la pantalla
|
||||
|
||||
@@ -9,9 +9,25 @@
|
||||
#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
|
||||
{
|
||||
// Variables
|
||||
std::vector<int> servicePressedCounter;
|
||||
|
||||
// Inicializa variables
|
||||
void init()
|
||||
{
|
||||
const int numInputs = Input::get()->getNumControllers() + 1;
|
||||
servicePressedCounter.reserve(numInputs);
|
||||
for (int i = 0; i < numInputs; ++i)
|
||||
{
|
||||
servicePressedCounter.push_back(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Termina
|
||||
void quit(section::options_e code)
|
||||
{
|
||||
if (Screen::get()->notificationsAreActive())
|
||||
{
|
||||
section::name = section::NAME_QUIT;
|
||||
@@ -21,27 +37,27 @@ void quit(section::options_e code)
|
||||
{
|
||||
Screen::get()->showNotification(lang::getText(94));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reinicia
|
||||
void reset()
|
||||
{
|
||||
// Reinicia
|
||||
void reset()
|
||||
{
|
||||
section::name = section::NAME_INIT;
|
||||
Screen::get()->showNotification("Reset");
|
||||
}
|
||||
}
|
||||
|
||||
// Activa o desactiva el audio
|
||||
void switchAudio()
|
||||
{
|
||||
// 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 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))
|
||||
{
|
||||
@@ -62,11 +78,21 @@ void checkGlobalInputs()
|
||||
return;
|
||||
}
|
||||
|
||||
else if (Input::get()->checkInput(input_service, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
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)
|
||||
{
|
||||
@@ -90,5 +116,22 @@ void checkGlobalInputs()
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,9 @@
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
void checkGlobalInputs();
|
||||
namespace globalInputs
|
||||
{
|
||||
|
||||
// Inicializa variables
|
||||
void init();
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
void check();
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "asset.h" // for Asset
|
||||
#include "background.h" // for Background
|
||||
#include "fade.h" // for Fade, FADE_IN, FADE_OUT, FADE_RANDOM...
|
||||
#include "global_inputs.h" // for checkGlobalInputs
|
||||
#include "global_inputs.h" // for globalInputs::check
|
||||
#include "input.h" // for Input
|
||||
#include "jail_audio.h" // for JA_GetMusicState, JA_Music_state
|
||||
#include "lang.h" // for getText
|
||||
@@ -220,7 +220,7 @@ void HiScoreTable::checkInput()
|
||||
screen->checkInput();
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
checkGlobalInputs();
|
||||
globalInputs::check();
|
||||
}
|
||||
|
||||
// Bucle para la pantalla de instrucciones
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <string> // for basic_string
|
||||
#include "asset.h" // for Asset
|
||||
#include "fade.h" // for Fade, FADE_FULLSCREEN, FADE_IN
|
||||
#include "global_inputs.h" // for checkGlobalInputs
|
||||
#include "global_inputs.h" // for globalInputs::check
|
||||
#include "input.h" // for Input
|
||||
#include "jail_audio.h" // for JA_GetMusicState, JA_Music_state
|
||||
#include "lang.h" // for getText
|
||||
@@ -353,7 +353,7 @@ void Instructions::checkInput()
|
||||
screen->checkInput();
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
checkGlobalInputs();
|
||||
globalInputs::check();
|
||||
}
|
||||
|
||||
// Bucle para la pantalla de instrucciones
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
|
||||
#include <string> // for basic_string
|
||||
#include "asset.h" // for Asset
|
||||
#include "global_inputs.h" // for checkGlobalInputs
|
||||
#include "global_inputs.h" // for globalInputs::check
|
||||
#include "input.h" // for Input
|
||||
#include "jail_audio.h" // for JA_StopMusic, JA_PlayMusic
|
||||
#include "lang.h" // for getText
|
||||
@@ -221,7 +221,7 @@ void Intro::checkInput()
|
||||
screen->checkInput();
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
checkGlobalInputs();
|
||||
globalInputs::check();
|
||||
}
|
||||
|
||||
// Actualiza las escenas de la intro
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
|
||||
#include <string> // for basic_string
|
||||
#include "asset.h" // for Asset
|
||||
#include "global_inputs.h" // for checkGlobalInputs
|
||||
#include "global_inputs.h" // for globalInputs::check
|
||||
#include "input.h" // for Input
|
||||
#include "jail_audio.h" // for JA_StopMusic
|
||||
#include "param.h" // for param
|
||||
@@ -126,7 +126,7 @@ void Logo::checkInput()
|
||||
screen->checkInput();
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
checkGlobalInputs();
|
||||
globalInputs::check();
|
||||
}
|
||||
|
||||
// Gestiona el logo de JAILGAME
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "define_buttons.h" // for DefineButtons
|
||||
#include "fade.h" // for Fade, FADE_RANDOM_SQUARE
|
||||
#include "game_logo.h" // for GameLogo
|
||||
#include "global_inputs.h" // for checkGlobalInputs
|
||||
#include "global_inputs.h" // for globalInputs::check
|
||||
#include "input.h" // for Input, inputs_e, INPUT_DO_NOT_ALLOW_RE...
|
||||
#include "jail_audio.h" // for JA_GetMusicState, JA_Music_state, JA_P...
|
||||
#include "lang.h" // for getText
|
||||
@@ -318,7 +318,7 @@ void Title::checkInput()
|
||||
defineButtons->checkInput();
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
checkGlobalInputs();
|
||||
globalInputs::check();
|
||||
}
|
||||
|
||||
// Bucle para el titulo del juego
|
||||
|
||||
Reference in New Issue
Block a user