diff --git a/source/common/screen.cpp b/source/common/screen.cpp index bb0baad..a611483 100644 --- a/source/common/screen.cpp +++ b/source/common/screen.cpp @@ -328,8 +328,6 @@ void Screen::checkInput() else if (input->checkInput(input_video_shaders, DO_NOT_ALLOW_REPEAT)) { switchShaders(); - const std::string value = options->video.shaders ? "on" : "off"; - showNotification("Shaders " + value); } #endif @@ -419,6 +417,8 @@ void Screen::switchShaders() { options->video.shaders = !options->video.shaders; setVideoMode(options->video.mode); + const std::string value = options->video.shaders ? "on" : "off"; + showNotification("Shaders " + value); } // Atenua la pantalla diff --git a/source/define_buttons.cpp b/source/define_buttons.cpp index 697cab6..d9e667e 100644 --- a/source/define_buttons.cpp +++ b/source/define_buttons.cpp @@ -20,17 +20,17 @@ DefineButtons::DefineButtons(Input *input, Text *text, param_t *param, options_t buttons.clear(); db_button_t button; - button.label = "DISPARO IZQUIERDA"; + button.label = "DISPARAR CAP A L'ESQUERRA"; button.input = input_fire_left; button.button = SDL_CONTROLLER_BUTTON_X; buttons.push_back(button); - button.label = "DISPARO CENTRO"; + button.label = "DISPARAR CAP AMUNT"; button.input = input_fire_center; button.button = SDL_CONTROLLER_BUTTON_Y; buttons.push_back(button); - button.label = "DISPARO DERECHA"; + button.label = "DISPARAR CAP A LA DRETA"; button.input = input_fire_right; button.button = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER; 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; buttons.push_back(button); - button.label = "SALIR DEL JUEGO"; + button.label = "SERVEI"; button.input = input_exit; button.button = SDL_CONTROLLER_BUTTON_BACK; buttons.push_back(button); @@ -69,7 +69,7 @@ void DefineButtons::render() { 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 + 10, buttons[indexButton].label); } diff --git a/source/service.cpp b/source/service.cpp index dd8ae34..78ed70d 100644 --- a/source/service.cpp +++ b/source/service.cpp @@ -1,25 +1,26 @@ #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; } - else if (input->checkInput(input_fire_left)) + else if (input->checkInput(input_fire_left, false, INPUT_USE_GAMECONTROLLER, index)) { 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; } - else if (input->checkInput(input_fire_right)) + else if (input->checkInput(input_fire_right, false, INPUT_USE_GAMECONTROLLER, index)) { return SERVICE_PAUSE; } diff --git a/source/service.h b/source/service.h index 754e99d..d75c29c 100644 --- a/source/service.h +++ b/source/service.h @@ -11,5 +11,5 @@ #define SERVICE_SHADERS 3 #define SERVICE_PAUSE 4 -// Comprueba el botón de servicio -int checkServiceButton(Input *input); \ No newline at end of file +// Comprueba el botón de servicio del controlador "index" +int checkServiceButton(Input *input, int index); \ No newline at end of file diff --git a/source/title.cpp b/source/title.cpp index 88b36e9..eefdd2b 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -221,15 +221,15 @@ void Title::checkEvents() } // Comprueba en el primer mando el botón de salir del programa - else if (eventHandler->type == SDL_CONTROLLERBUTTONDOWN) - { - if ((SDL_GameControllerButton)eventHandler->cbutton.which == 0) - if ((SDL_GameControllerButton)eventHandler->cbutton.button == input->getControllerBinding(0, input_exit)) - { - section->name = SECTION_PROG_QUIT; - break; - } - } + // else if (eventHandler->type == SDL_CONTROLLERBUTTONDOWN) + //{ + // if ((SDL_GameControllerButton)eventHandler->cbutton.which == 0) + // if ((SDL_GameControllerButton)eventHandler->cbutton.button == input->getControllerBinding(0, input_exit)) + // { + // section->name = SECTION_PROG_QUIT; + // break; + // } + //} } } } @@ -240,16 +240,9 @@ void Title::checkInput() // Comprueba los controladores solo si no se estan definiendo los botones if (!defineButtons->isEnabled()) { - // Comprueba si se ha pulsado algún botón para empezar a jugar - const int index = input->checkAnyButtonPressed(); - 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; - } - } + ////////////////////////////////////////////////// + // TECLADO // + ////////////////////////////////////////////////// // Comprueba el teclado para salir if (input->checkInput(input_exit, DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD)) @@ -269,6 +262,42 @@ void Title::checkInput() { 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 diff --git a/source/title.h b/source/title.h index 396c48f..5156363 100644 --- a/source/title.h +++ b/source/title.h @@ -20,6 +20,7 @@ #include "tiledbg.h" #include "game_logo.h" #include "define_buttons.h" +#include "service.h" // Textos #define TEXT_COPYRIGHT "@2020,2024 JailDesigner"