les tecles de funcio ja tornena a funcionar amb la consola oberta

This commit is contained in:
2026-03-28 14:03:41 +01:00
parent ed21a47f92
commit 854a5f04b2
4 changed files with 35 additions and 17 deletions

View File

@@ -190,28 +190,35 @@ 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()) {
const bool CONSOLE_ACTIVE = Console::get() != nullptr && Console::get()->isActive();
if (CONSOLE_ACTIVE) {
// TAB/ESC cierran la consola en lugar de ejecutar sus acciones normales
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();
const bool* ks = SDL_GetKeyboardState(nullptr);
if (((mod & SDL_KMOD_CTRL) != 0U) && ((mod & SDL_KMOD_SHIFT) != 0U) && ((mod & SDL_KMOD_ALT) != 0U) && ks[SDL_SCANCODE_Q]) {
SceneManager::current = SceneManager::Scene::QUIT;
return;
}
} else {
// Salida de administrador en modo kiosko (Ctrl+Shift+Alt+Q)
if (Options::kiosk.enabled) {
SDL_Keymod mod = SDL_GetModState();
const bool* ks = SDL_GetKeyboardState(nullptr);
if (((mod & SDL_KMOD_CTRL) != 0U) && ((mod & SDL_KMOD_SHIFT) != 0U) && ((mod & SDL_KMOD_ALT) != 0U) && ks[SDL_SCANCODE_Q]) {
SceneManager::current = SceneManager::Scene::QUIT;
return;
}
}
}
// Detectar qué acción global está siendo presionada
InputAction action = getPressedAction();
// Con consola activa, ACCEPT (saltar sección) y EXIT están bloqueados
if (CONSOLE_ACTIVE && (action == InputAction::ACCEPT || action == InputAction::EXIT)) {
return;
}
// Ejecutar el handler correspondiente usando switch statement
switch (action) {
case InputAction::EXIT:

View File

@@ -79,8 +79,8 @@ void RenderInfo::render() const {
std::transform(line.begin(), line.end(), line.begin(), [](unsigned char c) { return std::tolower(c); });
// Constantes visuales (igual que Console)
static constexpr Uint8 BG_COLOR = 0; // PaletteColor::BLACK
static constexpr Uint8 MSG_COLOR = 9; // PaletteColor::BRIGHT_GREEN
static constexpr Uint8 BG_COLOR = 0; // PaletteColor::BLACK
static constexpr Uint8 MSG_COLOR = 9; // PaletteColor::BRIGHT_GREEN
static constexpr int TEXT_SIZE = 6;
static constexpr int PADDING_V = TEXT_SIZE / 2 - 1;