refactor: JI_* a Ji:: i JG_* a Jg::
This commit is contained in:
@@ -171,10 +171,10 @@ namespace Gamepad {
|
||||
pad = nullptr;
|
||||
pad_id = 0;
|
||||
// Neteja qualsevol tecla virtual que poguera estar premuda
|
||||
JI_SetVirtualKey(SDL_SCANCODE_UP, JI_VSRC_GAMEPAD, false);
|
||||
JI_SetVirtualKey(SDL_SCANCODE_DOWN, JI_VSRC_GAMEPAD, false);
|
||||
JI_SetVirtualKey(SDL_SCANCODE_LEFT, JI_VSRC_GAMEPAD, false);
|
||||
JI_SetVirtualKey(SDL_SCANCODE_RIGHT, JI_VSRC_GAMEPAD, false);
|
||||
Ji::setVirtualKey(SDL_SCANCODE_UP, Ji::VirtualSource::GAMEPAD, false);
|
||||
Ji::setVirtualKey(SDL_SCANCODE_DOWN, Ji::VirtualSource::GAMEPAD, false);
|
||||
Ji::setVirtualKey(SDL_SCANCODE_LEFT, Ji::VirtualSource::GAMEPAD, false);
|
||||
Ji::setVirtualKey(SDL_SCANCODE_RIGHT, Ji::VirtualSource::GAMEPAD, false);
|
||||
notifyDisconnected(saved_name);
|
||||
}
|
||||
}
|
||||
@@ -259,17 +259,17 @@ namespace Gamepad {
|
||||
}
|
||||
|
||||
// Assegura que el joc no rep tecles de moviment mentre el menú està obert
|
||||
JI_SetVirtualKey(SDL_SCANCODE_UP, JI_VSRC_GAMEPAD, false);
|
||||
JI_SetVirtualKey(SDL_SCANCODE_DOWN, JI_VSRC_GAMEPAD, false);
|
||||
JI_SetVirtualKey(SDL_SCANCODE_LEFT, JI_VSRC_GAMEPAD, false);
|
||||
JI_SetVirtualKey(SDL_SCANCODE_RIGHT, JI_VSRC_GAMEPAD, false);
|
||||
Ji::setVirtualKey(SDL_SCANCODE_UP, Ji::VirtualSource::GAMEPAD, false);
|
||||
Ji::setVirtualKey(SDL_SCANCODE_DOWN, Ji::VirtualSource::GAMEPAD, false);
|
||||
Ji::setVirtualKey(SDL_SCANCODE_LEFT, Ji::VirtualSource::GAMEPAD, false);
|
||||
Ji::setVirtualKey(SDL_SCANCODE_RIGHT, Ji::VirtualSource::GAMEPAD, false);
|
||||
} else {
|
||||
// Moviment al joc — level-triggered (polling)
|
||||
JI_SetVirtualKey(SDL_SCANCODE_UP, JI_VSRC_GAMEPAD, up);
|
||||
JI_SetVirtualKey(SDL_SCANCODE_DOWN, JI_VSRC_GAMEPAD, dn);
|
||||
JI_SetVirtualKey(SDL_SCANCODE_LEFT, JI_VSRC_GAMEPAD, lt);
|
||||
JI_SetVirtualKey(SDL_SCANCODE_RIGHT, JI_VSRC_GAMEPAD, rt);
|
||||
// Qualsevol dels 4 botons frontals avança escenes (JI_AnyKey via Enter sintètic)
|
||||
Ji::setVirtualKey(SDL_SCANCODE_UP, Ji::VirtualSource::GAMEPAD, up);
|
||||
Ji::setVirtualKey(SDL_SCANCODE_DOWN, Ji::VirtualSource::GAMEPAD, dn);
|
||||
Ji::setVirtualKey(SDL_SCANCODE_LEFT, Ji::VirtualSource::GAMEPAD, lt);
|
||||
Ji::setVirtualKey(SDL_SCANCODE_RIGHT, Ji::VirtualSource::GAMEPAD, rt);
|
||||
// Qualsevol dels 4 botons frontals avança escenes (Ji::anyKey via Enter sintètic)
|
||||
if ((south && !prev_south) || (east && !prev_east) ||
|
||||
(west && !prev_west) || (north && !prev_north)) {
|
||||
pushKey(SDL_SCANCODE_RETURN);
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace GlobalInputs {
|
||||
bool consumed = false;
|
||||
|
||||
// F1 — Reduir zoom
|
||||
bool dec_zoom = JI_KeyPressed(KeyConfig::scancode("dec_zoom"));
|
||||
bool dec_zoom = Ji::keyPressed(KeyConfig::scancode("dec_zoom"));
|
||||
if (dec_zoom && !dec_zoom_prev) {
|
||||
Screen::get()->decZoom();
|
||||
char msg[32];
|
||||
@@ -40,7 +40,7 @@ namespace GlobalInputs {
|
||||
dec_zoom_prev = dec_zoom;
|
||||
|
||||
// F2 — Augmentar zoom
|
||||
bool inc_zoom = JI_KeyPressed(KeyConfig::scancode("inc_zoom"));
|
||||
bool inc_zoom = Ji::keyPressed(KeyConfig::scancode("inc_zoom"));
|
||||
if (inc_zoom && !inc_zoom_prev) {
|
||||
Screen::get()->incZoom();
|
||||
char msg[32];
|
||||
@@ -53,7 +53,7 @@ namespace GlobalInputs {
|
||||
inc_zoom_prev = inc_zoom;
|
||||
|
||||
// F3 — Toggle pantalla completa
|
||||
bool fullscreen = JI_KeyPressed(KeyConfig::scancode("fullscreen"));
|
||||
bool fullscreen = Ji::keyPressed(KeyConfig::scancode("fullscreen"));
|
||||
if (fullscreen && !fullscreen_prev) {
|
||||
Screen::get()->toggleFullscreen();
|
||||
Overlay::showNotification(Screen::get()->isFullscreen() ? Locale::get("notifications.fullscreen") : Locale::get("notifications.windowed"));
|
||||
@@ -64,7 +64,7 @@ namespace GlobalInputs {
|
||||
fullscreen_prev = fullscreen;
|
||||
|
||||
// F4 — Toggle shaders
|
||||
bool shader = JI_KeyPressed(KeyConfig::scancode("toggle_shader"));
|
||||
bool shader = Ji::keyPressed(KeyConfig::scancode("toggle_shader"));
|
||||
if (shader && !shader_prev) {
|
||||
Screen::get()->toggleShaders();
|
||||
Overlay::showNotification(Options::video.shader_enabled ? Locale::get("notifications.shader_on") : Locale::get("notifications.shader_off"));
|
||||
@@ -75,7 +75,7 @@ namespace GlobalInputs {
|
||||
shader_prev = shader;
|
||||
|
||||
// F5 — Toggle aspect ratio 4:3
|
||||
bool aspect = JI_KeyPressed(KeyConfig::scancode("toggle_aspect_ratio"));
|
||||
bool aspect = Ji::keyPressed(KeyConfig::scancode("toggle_aspect_ratio"));
|
||||
if (aspect && !aspect_prev) {
|
||||
Screen::get()->toggleAspectRatio();
|
||||
Overlay::showNotification(Options::video.aspect_ratio_4_3 ? Locale::get("notifications.aspect_43") : Locale::get("notifications.aspect_square"));
|
||||
@@ -86,7 +86,7 @@ namespace GlobalInputs {
|
||||
aspect_prev = aspect;
|
||||
|
||||
// F6 — Toggle supersampling
|
||||
bool ss = JI_KeyPressed(KeyConfig::scancode("toggle_supersampling"));
|
||||
bool ss = Ji::keyPressed(KeyConfig::scancode("toggle_supersampling"));
|
||||
if (ss && !ss_prev) {
|
||||
if (Screen::get()->toggleSupersampling()) {
|
||||
Overlay::showNotification(Options::video.supersampling ? Locale::get("notifications.ss_on") : Locale::get("notifications.ss_off"));
|
||||
@@ -98,7 +98,7 @@ namespace GlobalInputs {
|
||||
ss_prev = ss;
|
||||
|
||||
// F7 — Canviar tipus de shader (PostFX ↔ CrtPi)
|
||||
bool next_shader = JI_KeyPressed(KeyConfig::scancode("next_shader"));
|
||||
bool next_shader = Ji::keyPressed(KeyConfig::scancode("next_shader"));
|
||||
if (next_shader && !next_shader_prev) {
|
||||
if (Screen::get()->nextShaderType()) {
|
||||
char msg[64];
|
||||
@@ -112,7 +112,7 @@ namespace GlobalInputs {
|
||||
next_shader_prev = next_shader;
|
||||
|
||||
// F8 — Pròxim preset del shader actiu
|
||||
bool next_preset = JI_KeyPressed(KeyConfig::scancode("next_shader_preset"));
|
||||
bool next_preset = Ji::keyPressed(KeyConfig::scancode("next_shader_preset"));
|
||||
if (next_preset && !next_preset_prev) {
|
||||
if (Screen::get()->nextPreset()) {
|
||||
char msg[64];
|
||||
@@ -126,7 +126,7 @@ namespace GlobalInputs {
|
||||
next_preset_prev = next_preset;
|
||||
|
||||
// F9 — Cicla filtre de textura (NEAREST ↔ LINEAR), sempre aplicat
|
||||
bool texture_filter = JI_KeyPressed(KeyConfig::scancode("cycle_texture_filter"));
|
||||
bool texture_filter = Ji::keyPressed(KeyConfig::scancode("cycle_texture_filter"));
|
||||
if (texture_filter && !texture_filter_prev) {
|
||||
Screen::get()->cycleTextureFilter(+1);
|
||||
Overlay::showNotification(Options::video.texture_filter == Options::TextureFilter::LINEAR
|
||||
@@ -139,7 +139,7 @@ namespace GlobalInputs {
|
||||
texture_filter_prev = texture_filter;
|
||||
|
||||
// F10 — Toggle render info (FPS, driver, shader)
|
||||
bool render_info = JI_KeyPressed(KeyConfig::scancode("toggle_render_info"));
|
||||
bool render_info = Ji::keyPressed(KeyConfig::scancode("toggle_render_info"));
|
||||
if (render_info && !render_info_prev) {
|
||||
Overlay::toggleRenderInfo();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace GlobalInputs {
|
||||
// Comprovar una vegada per frame, després de JI_Update()
|
||||
// Comprovar una vegada per frame, després de Ji::update()
|
||||
// Retorna true si ha consumit alguna tecla (per suprimir-la de la capa de joc)
|
||||
auto handle() -> bool;
|
||||
} // namespace GlobalInputs
|
||||
|
||||
@@ -9,10 +9,10 @@ namespace KeyRemap {
|
||||
|
||||
static void mirror(SDL_Scancode custom, SDL_Scancode standard, const bool* ks) {
|
||||
if (custom == standard || custom == SDL_SCANCODE_UNKNOWN) {
|
||||
JI_SetVirtualKey(standard, JI_VSRC_REMAP, false);
|
||||
Ji::setVirtualKey(standard, Ji::VirtualSource::REMAP, false);
|
||||
return;
|
||||
}
|
||||
JI_SetVirtualKey(standard, JI_VSRC_REMAP, ks[custom]);
|
||||
Ji::setVirtualKey(standard, Ji::VirtualSource::REMAP, ks[custom]);
|
||||
}
|
||||
|
||||
void update() {
|
||||
|
||||
Reference in New Issue
Block a user