Añadidas nuevas funciones al botón de servicio
El botón de servicio se puede usar en cualquier sección del juego
This commit is contained in:
@@ -225,7 +225,13 @@ bool Input::checkAnyInput(int device, int index)
|
|||||||
// Comprueba si hay algún botón pulsado. Devuelve 0 en caso de no encontrar nada o el indice del dispositivo + 1. Se hace así para poder gastar el valor devuelto como un valor "booleano"
|
// Comprueba si hay algún botón pulsado. Devuelve 0 en caso de no encontrar nada o el indice del dispositivo + 1. Se hace así para poder gastar el valor devuelto como un valor "booleano"
|
||||||
int Input::checkAnyButtonPressed(bool repeat)
|
int Input::checkAnyButtonPressed(bool repeat)
|
||||||
{
|
{
|
||||||
// Solo comprueba los botones
|
// Si está pulsado el botón de servicio, ningún botón se puede considerar pulsado
|
||||||
|
if (checkInput(input_service, INPUT_ALLOW_REPEAT, INPUT_USE_ANY))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Solo comprueba los botones definidos previamente
|
||||||
for (auto bi : buttonInputs)
|
for (auto bi : buttonInputs)
|
||||||
{
|
{
|
||||||
// Comprueba el teclado
|
// Comprueba el teclado
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ enum inputs_e
|
|||||||
input_number_of_inputs
|
input_number_of_inputs
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ALLOW_REPEAT true
|
#define INPUT_ALLOW_REPEAT true
|
||||||
#define DO_NOT_ALLOW_REPEAT false
|
#define INPUT_DO_NOT_ALLOW_REPEAT false
|
||||||
|
|
||||||
#define INPUT_USE_KEYBOARD 0
|
#define INPUT_USE_KEYBOARD 0
|
||||||
#define INPUT_USE_GAMECONTROLLER 1
|
#define INPUT_USE_GAMECONTROLLER 1
|
||||||
@@ -111,7 +111,7 @@ public:
|
|||||||
bool checkAnyInput(int device = INPUT_USE_ANY, int index = 0);
|
bool checkAnyInput(int device = INPUT_USE_ANY, int index = 0);
|
||||||
|
|
||||||
// Comprueba si hay algún botón pulsado
|
// Comprueba si hay algún botón pulsado
|
||||||
int checkAnyButtonPressed(bool repeat = DO_NOT_ALLOW_REPEAT);
|
int checkAnyButtonPressed(bool repeat = INPUT_DO_NOT_ALLOW_REPEAT);
|
||||||
|
|
||||||
// Busca si hay mandos conectados
|
// Busca si hay mandos conectados
|
||||||
bool discoverGameControllers();
|
bool discoverGameControllers();
|
||||||
|
|||||||
@@ -319,21 +319,21 @@ void Screen::update()
|
|||||||
void Screen::checkInput()
|
void Screen::checkInput()
|
||||||
{
|
{
|
||||||
#ifndef ARCADE
|
#ifndef ARCADE
|
||||||
if (input->checkInput(input_window_fullscreen, DO_NOT_ALLOW_REPEAT))
|
if (input->checkInput(input_window_fullscreen, INPUT_DO_NOT_ALLOW_REPEAT))
|
||||||
{
|
{
|
||||||
switchVideoMode();
|
switchVideoMode();
|
||||||
const std::string mode = options->video.mode == SCREEN_VIDEO_MODE_WINDOW ? "Window" : "Fullscreen";
|
const std::string mode = options->video.mode == SCREEN_VIDEO_MODE_WINDOW ? "Window" : "Fullscreen";
|
||||||
showNotification(mode + " mode");
|
showNotification(mode + " mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkInput(input_window_dec_size, DO_NOT_ALLOW_REPEAT))
|
else if (input->checkInput(input_window_dec_size, INPUT_DO_NOT_ALLOW_REPEAT))
|
||||||
{
|
{
|
||||||
decWindowSize();
|
decWindowSize();
|
||||||
const std::string size = std::to_string(options->video.window.size);
|
const std::string size = std::to_string(options->video.window.size);
|
||||||
showNotification("Window size x" + size);
|
showNotification("Window size x" + size);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkInput(input_window_inc_size, DO_NOT_ALLOW_REPEAT))
|
else if (input->checkInput(input_window_inc_size, INPUT_DO_NOT_ALLOW_REPEAT))
|
||||||
{
|
{
|
||||||
incWindowSize();
|
incWindowSize();
|
||||||
const std::string size = std::to_string(options->video.window.size);
|
const std::string size = std::to_string(options->video.window.size);
|
||||||
@@ -341,12 +341,12 @@ void Screen::checkInput()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (input->checkInput(input_video_shaders, DO_NOT_ALLOW_REPEAT))
|
if (input->checkInput(input_video_shaders, INPUT_DO_NOT_ALLOW_REPEAT))
|
||||||
{
|
{
|
||||||
switchShaders();
|
switchShaders();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkInput(input_showinfo, DO_NOT_ALLOW_REPEAT))
|
else if (input->checkInput(input_showinfo, INPUT_DO_NOT_ALLOW_REPEAT))
|
||||||
{
|
{
|
||||||
showInfo = !showInfo;
|
showInfo = !showInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -511,7 +511,7 @@ void Director::initOptions()
|
|||||||
c.inputs.push_back(input_fire_center);
|
c.inputs.push_back(input_fire_center);
|
||||||
c.inputs.push_back(input_fire_right);
|
c.inputs.push_back(input_fire_right);
|
||||||
c.inputs.push_back(input_start);
|
c.inputs.push_back(input_start);
|
||||||
c.inputs.push_back(input_exit);
|
c.inputs.push_back(input_service);
|
||||||
|
|
||||||
c.buttons.clear();
|
c.buttons.clear();
|
||||||
c.buttons.push_back(SDL_CONTROLLER_BUTTON_X);
|
c.buttons.push_back(SDL_CONTROLLER_BUTTON_X);
|
||||||
@@ -779,8 +779,8 @@ bool Director::saveConfigFile()
|
|||||||
file << "controller" + joyIndex + ".inputs.fire_left=" + std::to_string((int)options->controller[index].buttons[0]) + "\n";
|
file << "controller" + joyIndex + ".inputs.fire_left=" + std::to_string((int)options->controller[index].buttons[0]) + "\n";
|
||||||
file << "controller" + joyIndex + ".inputs.fire_center=" + std::to_string((int)options->controller[index].buttons[1]) + "\n";
|
file << "controller" + joyIndex + ".inputs.fire_center=" + std::to_string((int)options->controller[index].buttons[1]) + "\n";
|
||||||
file << "controller" + joyIndex + ".inputs.fire_right=" + std::to_string((int)options->controller[index].buttons[2]) + "\n";
|
file << "controller" + joyIndex + ".inputs.fire_right=" + std::to_string((int)options->controller[index].buttons[2]) + "\n";
|
||||||
file << "controller" + joyIndex + ".inputs.fire_start=" + std::to_string((int)options->controller[index].buttons[3]) + "\n";
|
file << "controller" + joyIndex + ".inputs.start=" + std::to_string((int)options->controller[index].buttons[3]) + "\n";
|
||||||
file << "controller" + joyIndex + ".inputs.fire_exit=" + std::to_string((int)options->controller[index].buttons[4]) + "\n";
|
file << "controller" + joyIndex + ".inputs.service=" + std::to_string((int)options->controller[index].buttons[4]) + "\n";
|
||||||
|
|
||||||
if (index < numPlayers - 1)
|
if (index < numPlayers - 1)
|
||||||
{
|
{
|
||||||
@@ -1080,12 +1080,12 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
|||||||
options->controller[0].buttons[2] = (SDL_GameControllerButton)std::stoi(value);
|
options->controller[0].buttons[2] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (var == "controller1.inputs.fire_start")
|
else if (var == "controller1.inputs.start")
|
||||||
{
|
{
|
||||||
options->controller[0].buttons[3] = (SDL_GameControllerButton)std::stoi(value);
|
options->controller[0].buttons[3] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (var == "controller1.inputs.fire_exit")
|
else if (var == "controller1.inputs.service")
|
||||||
{
|
{
|
||||||
options->controller[0].buttons[4] = (SDL_GameControllerButton)std::stoi(value);
|
options->controller[0].buttons[4] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
}
|
}
|
||||||
@@ -1110,12 +1110,12 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
|||||||
options->controller[1].buttons[2] = (SDL_GameControllerButton)std::stoi(value);
|
options->controller[1].buttons[2] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (var == "controller2.inputs.fire_start")
|
else if (var == "controller2.inputs.start")
|
||||||
{
|
{
|
||||||
options->controller[1].buttons[3] = (SDL_GameControllerButton)std::stoi(value);
|
options->controller[1].buttons[3] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (var == "controller2.inputs.fire_exit")
|
else if (var == "controller2.inputs.service")
|
||||||
{
|
{
|
||||||
options->controller[1].buttons[4] = (SDL_GameControllerButton)std::stoi(value);
|
options->controller[1].buttons[4] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
#include "service.h"
|
||||||
|
|
||||||
#define GAME_OVER_COUNTER 350
|
#define GAME_OVER_COUNTER 350
|
||||||
|
|
||||||
@@ -124,7 +125,7 @@ void Game::init(int playerID)
|
|||||||
|
|
||||||
// Obtiene el "id" del jugador que va a jugar
|
// Obtiene el "id" del jugador que va a jugar
|
||||||
Player *player = getPlayer(playerID);
|
Player *player = getPlayer(playerID);
|
||||||
|
|
||||||
// Cambia el estado del jugador seleccionado
|
// Cambia el estado del jugador seleccionado
|
||||||
player->setStatusPlaying(PLAYER_STATUS_PLAYING);
|
player->setStatusPlaying(PLAYER_STATUS_PLAYING);
|
||||||
|
|
||||||
@@ -2038,20 +2039,37 @@ void Game::updateMenace()
|
|||||||
void Game::checkInput()
|
void Game::checkInput()
|
||||||
{
|
{
|
||||||
// Comprueba las teclas que afectan al programa (solo para el primer jugador)
|
// Comprueba las teclas que afectan al programa (solo para el primer jugador)
|
||||||
if (input->checkInput(input_exit, DO_NOT_ALLOW_REPEAT))
|
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT))
|
||||||
{
|
{
|
||||||
section->name = SECTION_PROG_QUIT;
|
section->name = SECTION_PROG_QUIT;
|
||||||
|
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkInput(input_reset, DO_NOT_ALLOW_REPEAT))
|
// Comprueba el botón de SERVICE
|
||||||
|
switch (checkServiceButton(input, 0))
|
||||||
|
{
|
||||||
|
case SERVICE_EXIT:
|
||||||
|
{
|
||||||
|
section->name = SECTION_PROG_QUIT;
|
||||||
|
section->options = SECTION_OPTIONS_QUIT_SHUTDOWN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SERVICE_SHADERS:
|
||||||
|
{
|
||||||
|
screen->switchShaders();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SERVICE_RESET:
|
||||||
{
|
{
|
||||||
section->name = SECTION_PROG_LOGO;
|
section->name = SECTION_PROG_LOGO;
|
||||||
screen->showNotification("Reset");
|
screen->showNotification("Reset");
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkInput(input_mute, DO_NOT_ALLOW_REPEAT))
|
case SERVICE_MUTE:
|
||||||
{
|
{
|
||||||
const bool value = !options->audio.music.enabled;
|
const bool value = !options->audio.music.enabled;
|
||||||
options->audio.music.enabled = value;
|
options->audio.music.enabled = value;
|
||||||
@@ -2060,12 +2078,19 @@ void Game::checkInput()
|
|||||||
JA_EnableSound(value);
|
JA_EnableSound(value);
|
||||||
const std::string text = value ? "on" : "off";
|
const std::string text = value ? "on" : "off";
|
||||||
screen->showNotification("Audio " + text);
|
screen->showNotification("Audio " + text);
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkInput(input_pause, DO_NOT_ALLOW_REPEAT))
|
case SERVICE_PAUSE:
|
||||||
{
|
{
|
||||||
pause(!paused);
|
pause(!paused);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modo Demo activo
|
// Modo Demo activo
|
||||||
@@ -2153,7 +2178,7 @@ void Game::checkInput()
|
|||||||
if (player->isPlaying())
|
if (player->isPlaying())
|
||||||
{
|
{
|
||||||
// Input a la izquierda
|
// Input a la izquierda
|
||||||
if (input->checkInput(input_left, ALLOW_REPEAT, options->controller[controllerIndex].deviceType, options->controller[controllerIndex].index))
|
if (input->checkInput(input_left, INPUT_ALLOW_REPEAT, options->controller[controllerIndex].deviceType, options->controller[controllerIndex].index))
|
||||||
{
|
{
|
||||||
player->setInput(input_left);
|
player->setInput(input_left);
|
||||||
#ifdef RECORDING
|
#ifdef RECORDING
|
||||||
@@ -2163,7 +2188,7 @@ void Game::checkInput()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Input a la derecha
|
// Input a la derecha
|
||||||
if (input->checkInput(input_right, ALLOW_REPEAT, options->controller[controllerIndex].deviceType, options->controller[controllerIndex].index))
|
if (input->checkInput(input_right, INPUT_ALLOW_REPEAT, options->controller[controllerIndex].deviceType, options->controller[controllerIndex].index))
|
||||||
{
|
{
|
||||||
player->setInput(input_right);
|
player->setInput(input_right);
|
||||||
#ifdef RECORDING
|
#ifdef RECORDING
|
||||||
@@ -2242,7 +2267,7 @@ void Game::checkInput()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Si no está jugando, el botón de start le permite continuar jugando
|
// Si no está jugando, el botón de start le permite continuar jugando
|
||||||
if (input->checkInput(input_start, ALLOW_REPEAT, options->controller[controllerIndex].deviceType, options->controller[controllerIndex].index))
|
if (input->checkInput(input_start, INPUT_ALLOW_REPEAT, options->controller[controllerIndex].deviceType, options->controller[controllerIndex].index))
|
||||||
{
|
{
|
||||||
// Si no ha entrado ya en el estado de game over, entonces se puede continuar
|
// Si no ha entrado ya en el estado de game over, entonces se puede continuar
|
||||||
if (gameOverCounter == GAME_OVER_COUNTER)
|
if (gameOverCounter == GAME_OVER_COUNTER)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "hiscore_table.h"
|
#include "hiscore_table.h"
|
||||||
|
#include "service.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
@@ -194,9 +195,10 @@ void HiScoreTable::checkEvents()
|
|||||||
// Comprueba las entradas
|
// Comprueba las entradas
|
||||||
void HiScoreTable::checkInput()
|
void HiScoreTable::checkInput()
|
||||||
{
|
{
|
||||||
if (input->checkInput(input_exit, DO_NOT_ALLOW_REPEAT))
|
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT))
|
||||||
{
|
{
|
||||||
section->name = SECTION_PROG_QUIT;
|
section->name = SECTION_PROG_QUIT;
|
||||||
|
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkAnyButtonPressed())
|
else if (input->checkAnyButtonPressed())
|
||||||
@@ -206,6 +208,22 @@ void HiScoreTable::checkInput()
|
|||||||
section->options = SECTION_OPTIONS_TITLE_1;
|
section->options = SECTION_OPTIONS_TITLE_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Comprueba el botón de SERVICE
|
||||||
|
switch (checkServiceButton(input, 0))
|
||||||
|
{
|
||||||
|
case SERVICE_EXIT:
|
||||||
|
section->name = SECTION_PROG_QUIT;
|
||||||
|
section->options = SECTION_OPTIONS_QUIT_SHUTDOWN;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SERVICE_SHADERS:
|
||||||
|
screen->switchShaders();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Comprueba el input para el resto de objetos
|
// Comprueba el input para el resto de objetos
|
||||||
screen->checkInput();
|
screen->checkInput();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "instructions.h"
|
#include "instructions.h"
|
||||||
|
#include "service.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
@@ -323,9 +324,10 @@ void Instructions::checkEvents()
|
|||||||
// Comprueba las entradas
|
// Comprueba las entradas
|
||||||
void Instructions::checkInput()
|
void Instructions::checkInput()
|
||||||
{
|
{
|
||||||
if (input->checkInput(input_exit, DO_NOT_ALLOW_REPEAT))
|
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT))
|
||||||
{
|
{
|
||||||
section->name = SECTION_PROG_QUIT;
|
section->name = SECTION_PROG_QUIT;
|
||||||
|
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkAnyButtonPressed())
|
else if (input->checkAnyButtonPressed())
|
||||||
@@ -335,6 +337,22 @@ void Instructions::checkInput()
|
|||||||
section->options = SECTION_OPTIONS_TITLE_1;
|
section->options = SECTION_OPTIONS_TITLE_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Comprueba el botón de SERVICE
|
||||||
|
switch (checkServiceButton(input, 0))
|
||||||
|
{
|
||||||
|
case SERVICE_EXIT:
|
||||||
|
section->name = SECTION_PROG_QUIT;
|
||||||
|
section->options = SECTION_OPTIONS_QUIT_SHUTDOWN;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SERVICE_SHADERS:
|
||||||
|
screen->switchShaders();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Comprueba el input para el resto de objetos
|
// Comprueba el input para el resto de objetos
|
||||||
screen->checkInput();
|
screen->checkInput();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "intro.h"
|
#include "intro.h"
|
||||||
|
#include "service.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Intro::Intro(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, section_t *section, JA_Music_t *music)
|
Intro::Intro(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, section_t *section, JA_Music_t *music)
|
||||||
@@ -193,9 +194,10 @@ void Intro::checkEvents()
|
|||||||
// Comprueba las entradas
|
// Comprueba las entradas
|
||||||
void Intro::checkInput()
|
void Intro::checkInput()
|
||||||
{
|
{
|
||||||
if (input->checkInput(input_exit, DO_NOT_ALLOW_REPEAT))
|
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT))
|
||||||
{
|
{
|
||||||
section->name = SECTION_PROG_QUIT;
|
section->name = SECTION_PROG_QUIT;
|
||||||
|
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkAnyButtonPressed())
|
else if (input->checkAnyButtonPressed())
|
||||||
@@ -205,6 +207,22 @@ void Intro::checkInput()
|
|||||||
section->options = SECTION_OPTIONS_TITLE_1;
|
section->options = SECTION_OPTIONS_TITLE_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Comprueba el botón de SERVICE
|
||||||
|
switch (checkServiceButton(input, 0))
|
||||||
|
{
|
||||||
|
case SERVICE_EXIT:
|
||||||
|
section->name = SECTION_PROG_QUIT;
|
||||||
|
section->options = SECTION_OPTIONS_QUIT_SHUTDOWN;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SERVICE_SHADERS:
|
||||||
|
screen->switchShaders();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Comprueba el input para el resto de objetos
|
// Comprueba el input para el resto de objetos
|
||||||
screen->checkInput();
|
screen->checkInput();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "logo.h"
|
#include "logo.h"
|
||||||
|
#include "service.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
@@ -103,9 +104,11 @@ void Logo::checkEvents()
|
|||||||
// Comprueba las entradas
|
// Comprueba las entradas
|
||||||
void Logo::checkInput()
|
void Logo::checkInput()
|
||||||
{
|
{
|
||||||
if (input->checkInput(input_exit, DO_NOT_ALLOW_REPEAT))
|
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT))
|
||||||
{
|
{
|
||||||
section->name = SECTION_PROG_QUIT;
|
section->name = SECTION_PROG_QUIT;
|
||||||
|
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkAnyButtonPressed())
|
else if (input->checkAnyButtonPressed())
|
||||||
@@ -114,6 +117,23 @@ void Logo::checkInput()
|
|||||||
section->options = SECTION_OPTIONS_TITLE_1;
|
section->options = SECTION_OPTIONS_TITLE_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Comprueba el botón de SERVICE
|
||||||
|
switch (checkServiceButton(input, 0))
|
||||||
|
{
|
||||||
|
case SERVICE_EXIT:
|
||||||
|
section->name = SECTION_PROG_QUIT;
|
||||||
|
section->options = SECTION_OPTIONS_QUIT_SHUTDOWN;
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SERVICE_SHADERS:
|
||||||
|
screen->switchShaders();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Comprueba el input para el resto de objetos
|
// Comprueba el input para el resto de objetos
|
||||||
screen->checkInput();
|
screen->checkInput();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ int main(int argc, char *argv[])
|
|||||||
// Destruye el objeto Director
|
// Destruye el objeto Director
|
||||||
delete director;
|
delete director;
|
||||||
|
|
||||||
std::cout << "\nGame end" << std::endl;
|
const std::string endType = exit == SECTION_OPTIONS_QUIT_NORMAL ? "to terminal" : "shutdown";
|
||||||
|
std::cout << "\nGame end -> " << endType << std::endl;
|
||||||
|
|
||||||
return exit;
|
return exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,21 @@ int checkServiceButton(Input *input, int index)
|
|||||||
{
|
{
|
||||||
return SERVICE_PAUSE;
|
return SERVICE_PAUSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (input->checkInput(input_up, false, INPUT_USE_GAMECONTROLLER, index))
|
||||||
|
{
|
||||||
|
return SERVICE_SWAP_CONTROLLERS;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (input->checkInput(input_down, false, INPUT_USE_GAMECONTROLLER, index))
|
||||||
|
{
|
||||||
|
return SERVICE_RESET;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (input->checkInput(input_left, false, INPUT_USE_GAMECONTROLLER, index))
|
||||||
|
{
|
||||||
|
return SERVICE_MUTE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return SERVICE_NULL;
|
return SERVICE_NULL;
|
||||||
|
|||||||
@@ -5,11 +5,17 @@
|
|||||||
#include "common/input.h"
|
#include "common/input.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
|
|
||||||
#define SERVICE_NULL 0
|
enum service_e
|
||||||
#define SERVICE_EXIT 1
|
{
|
||||||
#define SERVICE_CONFIG 2
|
SERVICE_NULL,
|
||||||
#define SERVICE_SHADERS 3
|
SERVICE_EXIT,
|
||||||
#define SERVICE_PAUSE 4
|
SERVICE_CONFIG,
|
||||||
|
SERVICE_SHADERS,
|
||||||
|
SERVICE_PAUSE,
|
||||||
|
SERVICE_SWAP_CONTROLLERS,
|
||||||
|
SERVICE_RESET,
|
||||||
|
SERVICE_MUTE
|
||||||
|
};
|
||||||
|
|
||||||
// Comprueba el botón de servicio del controlador "index"
|
// Comprueba el botón de servicio del controlador "index"
|
||||||
int checkServiceButton(Input *input, int index);
|
int checkServiceButton(Input *input, int index);
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "title.h"
|
#include "title.h"
|
||||||
|
#include "service.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Title::Title(Screen *screen, Asset *asset, Input *input, options_t *options, Lang *lang, param_t *param, section_t *section, JA_Music_t *music)
|
Title::Title(Screen *screen, Asset *asset, Input *input, options_t *options, Lang *lang, param_t *param, section_t *section, JA_Music_t *music)
|
||||||
@@ -248,14 +249,14 @@ void Title::checkInput()
|
|||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
|
|
||||||
// Comprueba el teclado para salir
|
// Comprueba el teclado para salir
|
||||||
if (input->checkInput(input_exit, DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||||
{
|
{
|
||||||
section->name = SECTION_PROG_QUIT;
|
section->name = SECTION_PROG_QUIT;
|
||||||
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba el teclado para empezar a jugar
|
// Comprueba el teclado para empezar a jugar
|
||||||
if (input->checkInput(input_start, false, INPUT_USE_KEYBOARD))
|
if (input->checkInput(input_start, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||||
{
|
{
|
||||||
if (section->options == SECTION_OPTIONS_TITLE_2 || ALLOW_TITLE_ANIMATION_SKIP)
|
if (section->options == SECTION_OPTIONS_TITLE_2 || ALLOW_TITLE_ANIMATION_SKIP)
|
||||||
{
|
{
|
||||||
@@ -284,6 +285,10 @@ void Title::checkInput()
|
|||||||
defineButtons->enable(0);
|
defineButtons->enable(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SERVICE_SWAP_CONTROLLERS:
|
||||||
|
defineButtons->swapControllers();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -291,7 +296,7 @@ void Title::checkInput()
|
|||||||
// Comprueba el botón de START de los mandos
|
// Comprueba el botón de START de los mandos
|
||||||
for (int i = 0; i < input->getNumControllers(); ++i)
|
for (int i = 0; i < input->getNumControllers(); ++i)
|
||||||
{
|
{
|
||||||
if (input->checkInput(input_start, false, INPUT_USE_GAMECONTROLLER, i))
|
if (input->checkInput(input_start, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||||
{
|
{
|
||||||
if (section->options == SECTION_OPTIONS_TITLE_2 || ALLOW_TITLE_ANIMATION_SKIP)
|
if (section->options == SECTION_OPTIONS_TITLE_2 || ALLOW_TITLE_ANIMATION_SKIP)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#include "tiledbg.h"
|
#include "tiledbg.h"
|
||||||
#include "game_logo.h"
|
#include "game_logo.h"
|
||||||
#include "define_buttons.h"
|
#include "define_buttons.h"
|
||||||
#include "service.h"
|
|
||||||
|
|
||||||
// Textos
|
// Textos
|
||||||
#define TEXT_COPYRIGHT "@2020,2024 JailDesigner"
|
#define TEXT_COPYRIGHT "@2020,2024 JailDesigner"
|
||||||
|
|||||||
Reference in New Issue
Block a user