les tecles de funcio ja tornena a funcionar amb la consola oberta
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "game/gameplay/cheevos.hpp" // Para Cheevos, Achievement
|
||||
#include "game/options.hpp" // Para Options, options, SectionState, Section
|
||||
#include "game/scene_manager.hpp" // Para SceneManager
|
||||
#include "game/ui/console.hpp" // Para Console
|
||||
#include "game/ui/console.hpp" // Para Console
|
||||
#include "utils/defines.hpp" // Para PlayArea::CENTER_X, GameCanvas::WIDTH
|
||||
#include "utils/utils.hpp" // Para stringToColor, PaletteColor, playMusic
|
||||
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
#include <vector> // Para vector
|
||||
|
||||
#include "core/audio/audio.hpp" // Para Audio
|
||||
#include "core/locale/locale.hpp" // Para Locale
|
||||
#include "core/rendering/render_info.hpp" // Para RenderInfo
|
||||
#include "core/rendering/screen.hpp" // Para Screen
|
||||
#include "core/rendering/sprite/sprite.hpp" // Para Sprite
|
||||
#include "core/rendering/surface.hpp" // Para Surface
|
||||
#include "core/rendering/text.hpp" // Para Text
|
||||
#include "core/resources/resource_cache.hpp" // Para Resource
|
||||
#include "core/locale/locale.hpp" // Para Locale
|
||||
#include "game/options.hpp" // Para Options
|
||||
#include "game/scene_manager.hpp" // Para SceneManager
|
||||
#include "game/ui/notifier.hpp" // Para Notifier
|
||||
@@ -97,6 +97,7 @@ static void printHelp() {
|
||||
SDL_Log(" MUSIC [ON|OFF|VOL <0-100>] Music volume");
|
||||
SDL_Log(" SOUND [ON|OFF|VOL <0-100>] Sound volume");
|
||||
SDL_Log(" SCENE [LOGO|LOADING|TITLE|CREDITS|GAME|ENDING|ENDING2|RESTART]");
|
||||
SDL_Log(" SIZE Window size in pixels");
|
||||
SDL_Log(" KIOSK [ON] Enable kiosk mode");
|
||||
SDL_Log(" EXIT / QUIT Quit application");
|
||||
SDL_Log(" SHOW [FPS|INFO|NOTIFICATION|CHEEVO] Show debug overlay or test notification");
|
||||
@@ -355,7 +356,9 @@ static const std::vector<ConsoleCommand> COMMANDS = {
|
||||
if (SceneManager::current != SceneManager::Scene::GAME) { return "Only available in GAME scene"; }
|
||||
if (args.empty()) { return "Usage: ROOM <1-60>"; }
|
||||
int num = 0;
|
||||
try { num = std::stoi(args[0]); } catch (...) { return "Usage: ROOM <1-60>"; }
|
||||
try {
|
||||
num = std::stoi(args[0]);
|
||||
} catch (...) { return "Usage: ROOM <1-60>"; }
|
||||
if (num < 1 || num > 60) { return "Room must be between 1 and 60"; }
|
||||
char buf[16];
|
||||
std::snprintf(buf, sizeof(buf), "%02d.yaml", num);
|
||||
@@ -602,6 +605,14 @@ static const std::vector<ConsoleCommand> COMMANDS = {
|
||||
return "Quitting...";
|
||||
}},
|
||||
|
||||
// SIZE — Devuelve el tamaño actual de la ventana en píxeles
|
||||
{.keyword = "SIZE", .execute = [](const std::vector<std::string>&) -> std::string {
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
SDL_GetWindowSize(SDL_GetRenderWindow(Screen::get()->getRenderer()), &w, &h);
|
||||
return std::to_string(w) + "x" + std::to_string(h);
|
||||
}},
|
||||
|
||||
// HELP / ? — Muestra ayuda en la terminal del sistema
|
||||
{.keyword = "HELP", .execute = [](const std::vector<std::string>&) -> std::string {
|
||||
printHelp();
|
||||
|
||||
Reference in New Issue
Block a user