les tecles de funcio ja no arriben a jinput

This commit is contained in:
2026-04-04 18:39:53 +02:00
parent b707bdd63b
commit 699989efb0
4 changed files with 41 additions and 16 deletions

View File

@@ -4,6 +4,7 @@
#include "core/input/global_inputs.hpp"
#include "core/jail/jgame.hpp"
#include "game/options.hpp"
const bool* keystates; // = SDL_GetKeyboardState( NULL );
SDL_Event event;
@@ -11,6 +12,13 @@ Uint8 cheat[5];
bool key_pressed = false;
int waitTime = 0;
// Comprova si un scancode pertany a les tecles reservades per a la GUI
static bool isGuiKey(SDL_Scancode sc) {
return sc == Options::keys_gui.dec_zoom ||
sc == Options::keys_gui.inc_zoom ||
sc == Options::keys_gui.fullscreen;
}
void JI_DisableKeyboard(Uint32 time) {
waitTime = time;
}
@@ -32,11 +40,15 @@ void JI_Update() {
while (SDL_PollEvent(&event)) {
if (event.type == SDL_EVENT_QUIT) JG_QuitSignal();
if (event.type == SDL_EVENT_KEY_UP) {
key_pressed = true;
JI_moveCheats(event.key.scancode);
// Si és una tecla GUI, no la passem al joc legacy
if (!isGuiKey(event.key.scancode)) {
key_pressed = true;
JI_moveCheats(event.key.scancode);
}
}
}
// GlobalInputs processa les tecles GUI per polling
GlobalInputs::handle();
}