forked from jaildesigner-jailgames/jaildoctors_dilemma
treballant en la consola
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "core/rendering/screen.hpp" // Para Screen
|
||||
#include "game/options.hpp" // Para Options, options, OptionsVideo, Section
|
||||
#include "game/scene_manager.hpp" // Para SceneManager
|
||||
#include "game/ui/console.hpp" // Para Console
|
||||
#include "game/ui/notifier.hpp" // Para Notifier, NotificationText
|
||||
#include "utils/utils.hpp" // Para stringInVector
|
||||
|
||||
@@ -176,6 +177,9 @@ namespace GlobalInputs {
|
||||
if (Input::get()->checkAction(InputAction::SHOW_DEBUG_INFO, Input::DO_NOT_ALLOW_REPEAT)) {
|
||||
return InputAction::SHOW_DEBUG_INFO;
|
||||
}
|
||||
if (Input::get()->checkAction(InputAction::TOGGLE_CONSOLE, Input::DO_NOT_ALLOW_REPEAT)) {
|
||||
return InputAction::TOGGLE_CONSOLE;
|
||||
}
|
||||
return InputAction::NONE;
|
||||
}
|
||||
|
||||
@@ -185,6 +189,15 @@ namespace GlobalInputs {
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
void handle() {
|
||||
// Si la consola está activa, bloquea el resto de inputs globales
|
||||
if (Console::get() != nullptr && Console::get()->isActive()) {
|
||||
if (Input::get()->checkAction(InputAction::TOGGLE_CONSOLE, Input::DO_NOT_ALLOW_REPEAT) ||
|
||||
Input::get()->checkAction(InputAction::EXIT, Input::DO_NOT_ALLOW_REPEAT)) {
|
||||
Console::get()->toggle();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Salida de administrador en modo kiosko (Ctrl+Shift+Alt+Q)
|
||||
if (Options::kiosk.enabled) {
|
||||
SDL_Keymod mod = SDL_GetModState();
|
||||
@@ -252,6 +265,10 @@ namespace GlobalInputs {
|
||||
handleToggleVSync();
|
||||
break;
|
||||
|
||||
case InputAction::TOGGLE_CONSOLE:
|
||||
if (Console::get() != nullptr) { Console::get()->toggle(); }
|
||||
break;
|
||||
|
||||
#ifdef _DEBUG
|
||||
case InputAction::TOGGLE_DEBUG:
|
||||
Screen::get()->toggleFPS();
|
||||
|
||||
@@ -51,7 +51,8 @@ Input::Input(std::string game_controller_db_path)
|
||||
{Action::TOGGLE_BORDER, KeyState{.scancode = SDL_SCANCODE_F9}},
|
||||
{Action::TOGGLE_VSYNC, KeyState{.scancode = SDL_SCANCODE_F10}},
|
||||
{Action::PAUSE, KeyState{.scancode = SDL_SCANCODE_F11}},
|
||||
{Action::TOGGLE_DEBUG, KeyState{.scancode = SDL_SCANCODE_F12}}};
|
||||
{Action::TOGGLE_DEBUG, KeyState{.scancode = SDL_SCANCODE_F12}},
|
||||
{Action::TOGGLE_CONSOLE, KeyState{.scancode = SDL_SCANCODE_TAB}}};
|
||||
|
||||
initSDLGamePad(); // Inicializa el subsistema SDL_INIT_GAMEPAD
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ enum class InputAction : int { // Acciones de entrada posibles en el juego
|
||||
PREVIOUS_PALETTE,
|
||||
SHOW_DEBUG_INFO,
|
||||
TOGGLE_DEBUG,
|
||||
TOGGLE_CONSOLE,
|
||||
|
||||
// Input obligatorio
|
||||
NONE,
|
||||
|
||||
Reference in New Issue
Block a user