#include "core/input/global_inputs.hpp" #include #include #include "core/jail/jinput.hpp" #include "core/rendering/overlay.hpp" #include "core/rendering/screen.hpp" #include "game/options.hpp" namespace GlobalInputs { static bool dec_zoom_prev = false; static bool inc_zoom_prev = false; static bool fullscreen_prev = false; static bool shader_prev = false; static bool aspect_prev = false; static bool ss_prev = false; static bool next_shader_prev = false; static bool next_preset_prev = false; auto handle() -> bool { bool consumed = false; // F1 — Reduir zoom bool dec_zoom = JI_KeyPressed(Options::keys_gui.dec_zoom); if (dec_zoom && !dec_zoom_prev) { Screen::get()->decZoom(); char msg[32]; snprintf(msg, sizeof(msg), "ZOOM %dx", Screen::get()->getZoom()); Overlay::showNotification(msg); } if (dec_zoom) consumed = true; dec_zoom_prev = dec_zoom; // F2 — Augmentar zoom bool inc_zoom = JI_KeyPressed(Options::keys_gui.inc_zoom); if (inc_zoom && !inc_zoom_prev) { Screen::get()->incZoom(); char msg[32]; snprintf(msg, sizeof(msg), "ZOOM %dx", Screen::get()->getZoom()); Overlay::showNotification(msg); } if (inc_zoom) consumed = true; inc_zoom_prev = inc_zoom; // F3 — Toggle pantalla completa bool fullscreen = JI_KeyPressed(Options::keys_gui.fullscreen); if (fullscreen && !fullscreen_prev) { Screen::get()->toggleFullscreen(); Overlay::showNotification(Screen::get()->isFullscreen() ? "PANTALLA COMPLETA" : "FINESTRA"); } if (fullscreen) consumed = true; fullscreen_prev = fullscreen; // F4 — Toggle shaders bool shader = JI_KeyPressed(Options::keys_gui.toggle_shader); if (shader && !shader_prev) { Screen::get()->toggleShaders(); Overlay::showNotification(Options::video.shader_enabled ? "SHADER ON" : "SHADER OFF"); } if (shader) consumed = true; shader_prev = shader; // F5 — Toggle aspect ratio 4:3 bool aspect = JI_KeyPressed(Options::keys_gui.toggle_aspect_ratio); if (aspect && !aspect_prev) { Screen::get()->toggleAspectRatio(); Overlay::showNotification(Options::video.aspect_ratio_4_3 ? "4:3 CRT" : "PIXELS QUADRATS"); } if (aspect) consumed = true; aspect_prev = aspect; // F6 — Toggle supersampling bool ss = JI_KeyPressed(Options::keys_gui.toggle_supersampling); if (ss && !ss_prev) { Screen::get()->toggleSupersampling(); Overlay::showNotification(Options::video.supersampling ? "SUPERSAMPLING ON" : "SUPERSAMPLING OFF"); } if (ss) consumed = true; ss_prev = ss; // F7 — Canviar shader (PostFX ↔ CrtPi) bool next_shader = JI_KeyPressed(Options::keys_gui.next_shader); if (next_shader && !next_shader_prev) { Screen::get()->nextShaderPreset(); Overlay::showNotification(Screen::get()->isHardwareAccelerated() ? "POSTFX / CRT-PI" : "SENSE GPU"); } if (next_shader) consumed = true; next_shader_prev = next_shader; // F8 — Pròxim preset del shader actiu bool next_preset = JI_KeyPressed(Options::keys_gui.next_shader_preset); if (next_preset && !next_preset_prev) { // TODO: ciclar presets quan estiguen implementats (YAML) Overlay::showNotification("PRESET: DEFAULT"); } if (next_preset) consumed = true; next_preset_prev = next_preset; return consumed; } } // namespace GlobalInputs