Añadido botón de servicio al titulo
This commit is contained in:
@@ -328,8 +328,6 @@ void Screen::checkInput()
|
|||||||
else if (input->checkInput(input_video_shaders, DO_NOT_ALLOW_REPEAT))
|
else if (input->checkInput(input_video_shaders, DO_NOT_ALLOW_REPEAT))
|
||||||
{
|
{
|
||||||
switchShaders();
|
switchShaders();
|
||||||
const std::string value = options->video.shaders ? "on" : "off";
|
|
||||||
showNotification("Shaders " + value);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -419,6 +417,8 @@ void Screen::switchShaders()
|
|||||||
{
|
{
|
||||||
options->video.shaders = !options->video.shaders;
|
options->video.shaders = !options->video.shaders;
|
||||||
setVideoMode(options->video.mode);
|
setVideoMode(options->video.mode);
|
||||||
|
const std::string value = options->video.shaders ? "on" : "off";
|
||||||
|
showNotification("Shaders " + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Atenua la pantalla
|
// Atenua la pantalla
|
||||||
|
|||||||
@@ -20,17 +20,17 @@ DefineButtons::DefineButtons(Input *input, Text *text, param_t *param, options_t
|
|||||||
buttons.clear();
|
buttons.clear();
|
||||||
db_button_t button;
|
db_button_t button;
|
||||||
|
|
||||||
button.label = "DISPARO IZQUIERDA";
|
button.label = "DISPARAR CAP A L'ESQUERRA";
|
||||||
button.input = input_fire_left;
|
button.input = input_fire_left;
|
||||||
button.button = SDL_CONTROLLER_BUTTON_X;
|
button.button = SDL_CONTROLLER_BUTTON_X;
|
||||||
buttons.push_back(button);
|
buttons.push_back(button);
|
||||||
|
|
||||||
button.label = "DISPARO CENTRO";
|
button.label = "DISPARAR CAP AMUNT";
|
||||||
button.input = input_fire_center;
|
button.input = input_fire_center;
|
||||||
button.button = SDL_CONTROLLER_BUTTON_Y;
|
button.button = SDL_CONTROLLER_BUTTON_Y;
|
||||||
buttons.push_back(button);
|
buttons.push_back(button);
|
||||||
|
|
||||||
button.label = "DISPARO DERECHA";
|
button.label = "DISPARAR CAP A LA DRETA";
|
||||||
button.input = input_fire_right;
|
button.input = input_fire_right;
|
||||||
button.button = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER;
|
button.button = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER;
|
||||||
buttons.push_back(button);
|
buttons.push_back(button);
|
||||||
@@ -40,7 +40,7 @@ DefineButtons::DefineButtons(Input *input, Text *text, param_t *param, options_t
|
|||||||
button.button = SDL_CONTROLLER_BUTTON_START;
|
button.button = SDL_CONTROLLER_BUTTON_START;
|
||||||
buttons.push_back(button);
|
buttons.push_back(button);
|
||||||
|
|
||||||
button.label = "SALIR DEL JUEGO";
|
button.label = "SERVEI";
|
||||||
button.input = input_exit;
|
button.input = input_exit;
|
||||||
button.button = SDL_CONTROLLER_BUTTON_BACK;
|
button.button = SDL_CONTROLLER_BUTTON_BACK;
|
||||||
buttons.push_back(button);
|
buttons.push_back(button);
|
||||||
@@ -69,7 +69,7 @@ void DefineButtons::render()
|
|||||||
{
|
{
|
||||||
if (enabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
text->writeCentered(x, y - 10, "PLAYER " + std::to_string(indexController + 1));
|
text->writeCentered(x, y - 10, "JUGADOR " + std::to_string(indexController + 1));
|
||||||
text->writeCentered(x, y, controllerNames[indexController]);
|
text->writeCentered(x, y, controllerNames[indexController]);
|
||||||
text->writeCentered(x, y + 10, buttons[indexButton].label);
|
text->writeCentered(x, y + 10, buttons[indexButton].label);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,26 @@
|
|||||||
#include "service.h"
|
#include "service.h"
|
||||||
|
|
||||||
int checkServiceButton(Input *input)
|
// Comprueba el botón de servicio del controlador "index"
|
||||||
|
int checkServiceButton(Input *input, int index)
|
||||||
{
|
{
|
||||||
if (input->checkInput(input_service))
|
if (input->checkInput(input_service, true, INPUT_USE_GAMECONTROLLER, index))
|
||||||
{
|
{
|
||||||
if (input->checkInput(input_start))
|
if (input->checkInput(input_start, false, INPUT_USE_GAMECONTROLLER, index))
|
||||||
{
|
{
|
||||||
return SERVICE_EXIT;
|
return SERVICE_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkInput(input_fire_left))
|
else if (input->checkInput(input_fire_left, false, INPUT_USE_GAMECONTROLLER, index))
|
||||||
{
|
{
|
||||||
return SERVICE_CONFIG;
|
return SERVICE_CONFIG;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkInput(input_fire_center))
|
else if (input->checkInput(input_fire_center, false, INPUT_USE_GAMECONTROLLER, index))
|
||||||
{
|
{
|
||||||
return SERVICE_SHADERS;
|
return SERVICE_SHADERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkInput(input_fire_right))
|
else if (input->checkInput(input_fire_right, false, INPUT_USE_GAMECONTROLLER, index))
|
||||||
{
|
{
|
||||||
return SERVICE_PAUSE;
|
return SERVICE_PAUSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,5 +11,5 @@
|
|||||||
#define SERVICE_SHADERS 3
|
#define SERVICE_SHADERS 3
|
||||||
#define SERVICE_PAUSE 4
|
#define SERVICE_PAUSE 4
|
||||||
|
|
||||||
// Comprueba el botón de servicio
|
// Comprueba el botón de servicio del controlador "index"
|
||||||
int checkServiceButton(Input *input);
|
int checkServiceButton(Input *input, int index);
|
||||||
@@ -221,15 +221,15 @@ void Title::checkEvents()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba en el primer mando el botón de salir del programa
|
// Comprueba en el primer mando el botón de salir del programa
|
||||||
else if (eventHandler->type == SDL_CONTROLLERBUTTONDOWN)
|
// else if (eventHandler->type == SDL_CONTROLLERBUTTONDOWN)
|
||||||
{
|
//{
|
||||||
if ((SDL_GameControllerButton)eventHandler->cbutton.which == 0)
|
// if ((SDL_GameControllerButton)eventHandler->cbutton.which == 0)
|
||||||
if ((SDL_GameControllerButton)eventHandler->cbutton.button == input->getControllerBinding(0, input_exit))
|
// if ((SDL_GameControllerButton)eventHandler->cbutton.button == input->getControllerBinding(0, input_exit))
|
||||||
{
|
// {
|
||||||
section->name = SECTION_PROG_QUIT;
|
// section->name = SECTION_PROG_QUIT;
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -240,16 +240,9 @@ void Title::checkInput()
|
|||||||
// Comprueba los controladores solo si no se estan definiendo los botones
|
// Comprueba los controladores solo si no se estan definiendo los botones
|
||||||
if (!defineButtons->isEnabled())
|
if (!defineButtons->isEnabled())
|
||||||
{
|
{
|
||||||
// Comprueba si se ha pulsado algún botón para empezar a jugar
|
//////////////////////////////////////////////////
|
||||||
const int index = input->checkAnyButtonPressed();
|
// TECLADO //
|
||||||
if (index)
|
//////////////////////////////////////////////////
|
||||||
{
|
|
||||||
if (section->subsection == SUBSECTION_TITLE_2 || ALLOW_TITLE_ANIMATION_SKIP)
|
|
||||||
{ // No se puede empezar a jugar durante la animación del titulo a menos que se permita
|
|
||||||
fade->activate();
|
|
||||||
postFade = index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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, DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||||
@@ -269,6 +262,42 @@ void Title::checkInput()
|
|||||||
{
|
{
|
||||||
defineButtons->enable(1);
|
defineButtons->enable(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
// MANDO //
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Comprueba el botón de SERVICE
|
||||||
|
switch (checkServiceButton(input, 0))
|
||||||
|
{
|
||||||
|
case SERVICE_EXIT:
|
||||||
|
section->name = SECTION_PROG_QUIT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SERVICE_SHADERS:
|
||||||
|
screen->switchShaders();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SERVICE_CONFIG:
|
||||||
|
defineButtons->enable(0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Comprueba el botón de START
|
||||||
|
for (int i = 0; i < input->getNumControllers(); ++i)
|
||||||
|
{
|
||||||
|
if (input->checkInput(input_start, false, INPUT_USE_GAMECONTROLLER, i))
|
||||||
|
{
|
||||||
|
if (section->subsection == SUBSECTION_TITLE_2 || ALLOW_TITLE_ANIMATION_SKIP)
|
||||||
|
{
|
||||||
|
fade->activate();
|
||||||
|
postFade = i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba el input para el resto de objetos
|
// Comprueba el input para el resto de objetos
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#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