diff --git a/source/director.cpp b/source/director.cpp index 3a96d31..670c63c 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -176,8 +176,12 @@ void Director::bindInputs() Input::get()->bindKey(InputAction::START, SDL_SCANCODE_RETURN); - // Teclado - Control del programa + // Teclado - Menu de servicio Input::get()->bindKey(InputAction::SERVICE, SDL_SCANCODE_0); + Input::get()->bindKey(InputAction::SM_SELECT, SDL_SCANCODE_RETURN); + Input::get()->bindKey(InputAction::SM_BACK, SDL_SCANCODE_BACKSPACE); + + // Teclado - Control del programa Input::get()->bindKey(InputAction::EXIT, SDL_SCANCODE_ESCAPE); Input::get()->bindKey(InputAction::PAUSE, SDL_SCANCODE_P); Input::get()->bindKey(InputAction::BACK, SDL_SCANCODE_BACKSPACE); @@ -213,8 +217,10 @@ void Director::bindInputs() Input::get()->bindGameControllerButton(i, InputAction::START, SDL_GAMEPAD_BUTTON_START); - // Mando - Control del programa + // Teclado - Menu de servicio Input::get()->bindGameControllerButton(i, InputAction::SERVICE, SDL_GAMEPAD_BUTTON_BACK); + Input::get()->bindGameControllerButton(i, InputAction::SM_SELECT, SDL_GAMEPAD_BUTTON_WEST); + Input::get()->bindGameControllerButton(i, InputAction::SM_BACK, SDL_GAMEPAD_BUTTON_NORTH); } // Mapea las asignaciones a los botones desde el archivo de configuración, si se da el caso diff --git a/source/global_inputs.cpp b/source/global_inputs.cpp index d5290ae..0c46c23 100644 --- a/source/global_inputs.cpp +++ b/source/global_inputs.cpp @@ -170,6 +170,32 @@ namespace globalInputs ServiceMenu::get()->toggle(); } + // Cambia el modo de pantalla completa + void toggleFullscreen() + { + Screen::get()->toggleFullscreen(); + const std::string MODE = options.video.fullscreen ? lang::getText("[NOTIFICATIONS] 11") : lang::getText("[NOTIFICATIONS] 10"); + Notifier::get()->show({MODE}); + } + + // Reduce el tamaño de la ventana + void decWindowSize() + { + if (Screen::get()->decWindowSize()) + { + Notifier::get()->show({lang::getText("[NOTIFICATIONS] 09") + " x" + std::to_string(options.window.size)}); + } + } + + // Aumenta el tamaño de la ventana + void incWindowSize() + { + if (Screen::get()->incWindowSize()) + { + Notifier::get()->show({lang::getText("[NOTIFICATIONS] 09") + " x" + std::to_string(options.window.size)}); + } + } + // Comprueba el boton de servicio void checkServiceButton() { @@ -184,7 +210,7 @@ namespace globalInputs { for (int i = 0; i < Input::get()->getNumControllers(); ++i) { - if (Input::get()->checkInput(InputAction::SERVICE, INPUT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i)) + if (Input::get()->checkInput(InputAction::SERVICE, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i)) { toggleServiceMenu(); return; @@ -230,14 +256,14 @@ namespace globalInputs } // Aceptar - if (Input::get()->checkInput(InputAction::START, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::KEYBOARD)) + if (Input::get()->checkInput(InputAction::SM_SELECT, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::KEYBOARD)) { ServiceMenu::get()->selectOption(); return; } // Atras - if (Input::get()->checkInput(InputAction::BACK, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::KEYBOARD)) + if (Input::get()->checkInput(InputAction::SM_BACK, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::KEYBOARD)) { ServiceMenu::get()->moveBack(); return; @@ -249,42 +275,42 @@ namespace globalInputs for (int i = 0; i < Input::get()->getNumControllers(); ++i) { // Arriba - if (Input::get()->checkInput(InputAction::UP, INPUT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i)) + if (Input::get()->checkInput(InputAction::UP, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i)) { ServiceMenu::get()->setSelectorUp(); return; } // Abajo - if (Input::get()->checkInput(InputAction::DOWN, INPUT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i)) + if (Input::get()->checkInput(InputAction::DOWN, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i)) { ServiceMenu::get()->setSelectorDown(); return; } // Derecha - if (Input::get()->checkInput(InputAction::RIGHT, INPUT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i)) + if (Input::get()->checkInput(InputAction::RIGHT, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i)) { ServiceMenu::get()->adjustOption(true); return; } // Izquierda - if (Input::get()->checkInput(InputAction::LEFT, INPUT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i)) + if (Input::get()->checkInput(InputAction::LEFT, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i)) { ServiceMenu::get()->adjustOption(false); return; } // Aceptar - if (Input::get()->checkInput(InputAction::FIRE_LEFT, INPUT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i)) + if (Input::get()->checkInput(InputAction::SM_SELECT, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i)) { ServiceMenu::get()->selectOption(); return; } // Atras - if (Input::get()->checkInput(InputAction::FIRE_CENTER, INPUT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i)) + if (Input::get()->checkInput(InputAction::SM_BACK, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i)) { ServiceMenu::get()->moveBack(); return; @@ -310,7 +336,7 @@ namespace globalInputs // Comprueba el teclado para decrementar el tamaño de la ventana if (Input::get()->checkInput(InputAction::WINDOW_DEC_SIZE, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::KEYBOARD)) { - if (Screen::get()->decWindowZoom()) + if (Screen::get()->decWindowSize()) { Notifier::get()->show({lang::getText("[NOTIFICATIONS] 09") + " x" + std::to_string(options.window.size)}); } @@ -320,7 +346,7 @@ namespace globalInputs // Comprueba el teclado para incrementar el tamaño de la ventana if (Input::get()->checkInput(InputAction::WINDOW_INC_SIZE, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::KEYBOARD)) { - if (Screen::get()->incWindowZoom()) + if (Screen::get()->incWindowSize()) { Notifier::get()->show({lang::getText("[NOTIFICATIONS] 09") + " x" + std::to_string(options.window.size)}); } diff --git a/source/input.h b/source/input.h index babe142..a9df8fc 100644 --- a/source/input.h +++ b/source/input.h @@ -31,6 +31,10 @@ enum class InputAction : int FIRE_RIGHT, START, + // Service Menu + SM_SELECT, + SM_BACK, + // Inputs de control BACK, EXIT, diff --git a/source/screen.cpp b/source/screen.cpp index be5ecf0..ab43cb6 100644 --- a/source/screen.cpp +++ b/source/screen.cpp @@ -130,7 +130,7 @@ void Screen::setWindowZoom(int zoom) } // Reduce el tamaño de la ventana -bool Screen::decWindowZoom() +bool Screen::decWindowSize() { if (!options.video.fullscreen) { @@ -149,7 +149,7 @@ bool Screen::decWindowZoom() } // Aumenta el tamaño de la ventana -bool Screen::incWindowZoom() +bool Screen::incWindowSize() { if (!options.video.fullscreen) { diff --git a/source/screen.h b/source/screen.h index 650a7b4..efac7a3 100644 --- a/source/screen.h +++ b/source/screen.h @@ -38,8 +38,8 @@ public: void setFullscreenMode(bool mode = options.video.fullscreen); // Establece el modo de video void toggleFullscreen(); // Cambia entre pantalla completa y ventana void setWindowZoom(int size); // Cambia el tamaño de la ventana - bool decWindowZoom(); // Reduce el tamaño de la ventana - bool incWindowZoom(); // Aumenta el tamaño de la ventana + bool decWindowSize(); // Reduce el tamaño de la ventana + bool incWindowSize(); // Aumenta el tamaño de la ventana void applySettings(); // Aplica los valores de las opciones // --- Efectos visuales ---