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() {
|
||||
|
||||
+12
-12
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
bool quitting = false;
|
||||
bool is_quitting = false;
|
||||
Uint32 update_ticks = 0;
|
||||
Uint32 update_time = 0;
|
||||
Uint32 cycle_counter = 0;
|
||||
@@ -10,29 +10,29 @@ namespace {
|
||||
|
||||
} // namespace
|
||||
|
||||
void JG_Init() {
|
||||
void Jg::init() {
|
||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
|
||||
update_time = SDL_GetTicks();
|
||||
last_delta_time = update_time;
|
||||
}
|
||||
|
||||
void JG_Finalize() {
|
||||
void Jg::finalize() {
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
void JG_QuitSignal() {
|
||||
quitting = true;
|
||||
void Jg::quitSignal() {
|
||||
is_quitting = true;
|
||||
}
|
||||
|
||||
auto JG_Quitting() -> bool {
|
||||
return quitting;
|
||||
auto Jg::quitting() -> bool {
|
||||
return is_quitting;
|
||||
}
|
||||
|
||||
void JG_SetUpdateTicks(Uint32 milliseconds) {
|
||||
void Jg::setUpdateTicks(Uint32 milliseconds) {
|
||||
update_ticks = milliseconds;
|
||||
}
|
||||
|
||||
auto JG_ShouldUpdate() -> bool {
|
||||
auto Jg::shouldUpdate() -> bool {
|
||||
const Uint32 now = SDL_GetTicks();
|
||||
if (now - update_time > update_ticks) {
|
||||
update_time = now;
|
||||
@@ -40,16 +40,16 @@ auto JG_ShouldUpdate() -> bool {
|
||||
return true;
|
||||
}
|
||||
// No toca update — retornem false sense més. Des de Phase B.2 ja no
|
||||
// hi ha fibers: cap caller fa spin-waits (`while (!JG_ShouldUpdate())`)
|
||||
// hi ha fibers: cap caller fa spin-waits (`while (!Jg::shouldUpdate())`)
|
||||
// i el Director pren el control del main loop frame a frame.
|
||||
return false;
|
||||
}
|
||||
|
||||
auto JG_GetCycleCounter() -> Uint32 {
|
||||
auto Jg::getCycleCounter() -> Uint32 {
|
||||
return cycle_counter;
|
||||
}
|
||||
|
||||
auto JG_GetDeltaMs() -> Uint32 {
|
||||
auto Jg::getDeltaMs() -> Uint32 {
|
||||
const Uint32 now = SDL_GetTicks();
|
||||
const Uint32 delta = now - last_delta_time;
|
||||
last_delta_time = now;
|
||||
|
||||
+24
-20
@@ -1,20 +1,24 @@
|
||||
#pragma once
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
void JG_Init();
|
||||
|
||||
void JG_Finalize();
|
||||
|
||||
void JG_QuitSignal();
|
||||
|
||||
auto JG_Quitting() -> bool;
|
||||
|
||||
void JG_SetUpdateTicks(Uint32 milliseconds);
|
||||
|
||||
auto JG_ShouldUpdate() -> bool;
|
||||
|
||||
auto JG_GetCycleCounter() -> Uint32;
|
||||
|
||||
// Temps transcorregut (en ms) des de l'última crida a JG_GetDeltaMs.
|
||||
// Helper per a la migració progressiva a time-based (Fase 4+).
|
||||
auto JG_GetDeltaMs() -> Uint32;
|
||||
#pragma once
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
namespace Jg {
|
||||
|
||||
void init();
|
||||
|
||||
void finalize();
|
||||
|
||||
void quitSignal();
|
||||
|
||||
auto quitting() -> bool;
|
||||
|
||||
void setUpdateTicks(Uint32 milliseconds);
|
||||
|
||||
auto shouldUpdate() -> bool;
|
||||
|
||||
auto getCycleCounter() -> Uint32;
|
||||
|
||||
// Temps transcorregut (en ms) des de l'última crida a Jg::getDeltaMs.
|
||||
// Helper per a la migració progressiva a time-based (Fase 4+).
|
||||
auto getDeltaMs() -> Uint32;
|
||||
|
||||
} // namespace Jg
|
||||
|
||||
+14
-13
@@ -17,18 +17,18 @@ namespace {
|
||||
|
||||
bool key_pressed = false;
|
||||
|
||||
// Temps restant en mil·lisegons durant el qual JI_KeyPressed/JI_AnyKey
|
||||
// Temps restant en mil·lisegons durant el qual Ji::keyPressed/Ji::anyKey
|
||||
// retornen false. Utilitzat per a evitar que pulsacions fortuïtes
|
||||
// saltin cinemàtiques al començament.
|
||||
float wait_ms = 0.0F;
|
||||
|
||||
// Per a calcular el delta entre crides a JI_Update sense que els callers
|
||||
// Per a calcular el delta entre crides a Ji::update sense que els callers
|
||||
// hagen de passar-lo explícitament. Es reinicia a la primera crida.
|
||||
Uint64 last_update_tick = 0;
|
||||
|
||||
bool input_blocked = false;
|
||||
|
||||
Uint8 virtual_keystates[JI_VSRC_COUNT][SDL_SCANCODE_COUNT] = {{0}};
|
||||
Uint8 virtual_keystates[static_cast<size_t>(Ji::VirtualSource::COUNT)][SDL_SCANCODE_COUNT] = {{0}};
|
||||
|
||||
auto scancode_to_ascii(Uint8 scancode) -> Uint8 {
|
||||
if (scancode >= SDL_SCANCODE_A && scancode <= SDL_SCANCODE_Z) {
|
||||
@@ -39,25 +39,26 @@ namespace {
|
||||
|
||||
} // namespace
|
||||
|
||||
void JI_DisableKeyboard(Uint32 time) {
|
||||
void Ji::disableKeyboard(Uint32 time) {
|
||||
wait_ms = static_cast<float>(time);
|
||||
}
|
||||
|
||||
void JI_SetInputBlocked(bool blocked) {
|
||||
void Ji::setInputBlocked(bool blocked) {
|
||||
input_blocked = blocked;
|
||||
}
|
||||
|
||||
void JI_SetVirtualKey(int scancode, int source, bool pressed) {
|
||||
void Ji::setVirtualKey(int scancode, VirtualSource source, bool pressed) {
|
||||
if (scancode < 0 || scancode >= SDL_SCANCODE_COUNT) {
|
||||
return;
|
||||
}
|
||||
if (source < 0 || source >= JI_VSRC_COUNT) {
|
||||
const auto src_idx = static_cast<size_t>(source);
|
||||
if (src_idx >= static_cast<size_t>(VirtualSource::COUNT)) {
|
||||
return;
|
||||
}
|
||||
virtual_keystates[source][scancode] = pressed ? 1 : 0;
|
||||
virtual_keystates[src_idx][scancode] = pressed ? 1 : 0;
|
||||
}
|
||||
|
||||
void JI_moveCheats(Uint8 scancode) {
|
||||
void Ji::moveCheats(Uint8 scancode) {
|
||||
cheat[0] = cheat[1];
|
||||
cheat[1] = cheat[2];
|
||||
cheat[2] = cheat[3];
|
||||
@@ -65,7 +66,7 @@ void JI_moveCheats(Uint8 scancode) {
|
||||
cheat[4] = scancode_to_ascii(scancode);
|
||||
}
|
||||
|
||||
void JI_Update() {
|
||||
void Ji::update() {
|
||||
// El director ha processat tots els events. Ací només refresquem
|
||||
// el snapshot del teclat i consumim el flag de tecla polsada.
|
||||
if (keystates == nullptr) {
|
||||
@@ -88,7 +89,7 @@ void JI_Update() {
|
||||
key_pressed = Director::get()->consumeKeyPressed();
|
||||
}
|
||||
|
||||
auto JI_KeyPressed(int key) -> bool {
|
||||
auto Ji::keyPressed(int key) -> bool {
|
||||
if (wait_ms > 0.0F || keystates == nullptr) {
|
||||
return false;
|
||||
}
|
||||
@@ -109,7 +110,7 @@ auto JI_KeyPressed(int key) -> bool {
|
||||
return std::ranges::any_of(virtual_keystates, [key](const auto& vk) { return vk[key] != 0; });
|
||||
}
|
||||
|
||||
auto JI_CheatActivated(const char* cheat_code) -> bool {
|
||||
auto Ji::cheatActivated(const char* cheat_code) -> bool {
|
||||
const size_t len = std::strlen(cheat_code);
|
||||
if (len > sizeof(cheat)) {
|
||||
return false;
|
||||
@@ -125,6 +126,6 @@ auto JI_CheatActivated(const char* cheat_code) -> bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto JI_AnyKey() -> bool {
|
||||
auto Ji::anyKey() -> bool {
|
||||
return wait_ms > 0.0F ? false : key_pressed;
|
||||
}
|
||||
|
||||
+36
-27
@@ -1,27 +1,36 @@
|
||||
#pragma once
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
void JI_DisableKeyboard(Uint32 time);
|
||||
|
||||
// Bloqueja tot l'input cap al joc (JI_KeyPressed retorna false per a tot)
|
||||
void JI_SetInputBlocked(bool blocked);
|
||||
|
||||
// Estableix l'estat d'una tecla virtual. Múltiples fonts (gamepad, remap)
|
||||
// s'agrupen per OR. JI_KeyPressed retorna true si el teclat real O qualsevol
|
||||
// font virtual està premuda.
|
||||
enum JI_VirtualSource : std::uint8_t {
|
||||
JI_VSRC_GAMEPAD = 0,
|
||||
JI_VSRC_REMAP = 1,
|
||||
JI_VSRC_COUNT = 2
|
||||
};
|
||||
void JI_SetVirtualKey(int scancode, int source, bool pressed);
|
||||
|
||||
void JI_Update();
|
||||
|
||||
auto JI_KeyPressed(int key) -> bool;
|
||||
|
||||
auto JI_CheatActivated(const char* cheat_code) -> bool;
|
||||
|
||||
auto JI_AnyKey() -> bool;
|
||||
#pragma once
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Ji {
|
||||
|
||||
void disableKeyboard(Uint32 time);
|
||||
|
||||
// Bloqueja tot l'input cap al joc (Ji::keyPressed retorna false per a tot)
|
||||
void setInputBlocked(bool blocked);
|
||||
|
||||
// Estableix l'estat d'una tecla virtual. Múltiples fonts (gamepad, remap)
|
||||
// s'agrupen per OR. Ji::keyPressed retorna true si el teclat real O qualsevol
|
||||
// font virtual està premuda.
|
||||
enum class VirtualSource : std::uint8_t {
|
||||
GAMEPAD = 0,
|
||||
REMAP = 1,
|
||||
COUNT = 2
|
||||
};
|
||||
void setVirtualKey(int scancode, VirtualSource source, bool pressed);
|
||||
|
||||
void update();
|
||||
|
||||
// Avança el buffer rotatori de cheats afegint `scancode` per detectar
|
||||
// seqüències com "reviu", "alone", "obert". Usat pel Director quan rep
|
||||
// un KEY_DOWN; el joc no l'ha de cridar directament.
|
||||
void moveCheats(Uint8 scancode);
|
||||
|
||||
auto keyPressed(int key) -> bool;
|
||||
|
||||
auto cheatActivated(const char* cheat_code) -> bool;
|
||||
|
||||
auto anyKey() -> bool;
|
||||
|
||||
} // namespace Ji
|
||||
|
||||
@@ -32,9 +32,6 @@
|
||||
#include "game/scenes/secreta_scene.hpp"
|
||||
#include "game/scenes/slides_scene.hpp"
|
||||
|
||||
// Cheats del joc original — declarats a jinput.cpp
|
||||
extern void JI_moveCheats(Uint8 new_key);
|
||||
|
||||
std::unique_ptr<Director> Director::instance_;
|
||||
|
||||
Director::~Director() = default;
|
||||
@@ -141,7 +138,7 @@ void Director::setup() {
|
||||
|
||||
auto Director::iterate() -> bool {
|
||||
if (quit_requested_) {
|
||||
JG_QuitSignal();
|
||||
Jg::quitSignal();
|
||||
current_scene_.reset(); // destrueix l'escena actual ordenadament
|
||||
return false;
|
||||
}
|
||||
@@ -162,7 +159,7 @@ auto Director::iterate() -> bool {
|
||||
game_state_ = 1; // 1 = dispatch via SceneRegistry per num_piramide
|
||||
has_frame_ = false;
|
||||
Menu::close();
|
||||
JI_SetInputBlocked(false); // el menú ho havia bloquejat — cal desfer-ho
|
||||
Ji::setInputBlocked(false); // el menú ho havia bloquejat — cal desfer-ho
|
||||
}
|
||||
|
||||
if (!context_initialized_) {
|
||||
@@ -207,7 +204,7 @@ auto Director::iterate() -> bool {
|
||||
// Transicions: si l'escena actual ha acabat (o s'ha senyalat
|
||||
// quit), llegim el seu next state i la destruïm per crear la
|
||||
// següent a continuació.
|
||||
if (current_scene_ && (current_scene_->done() || JG_Quitting())) {
|
||||
if (current_scene_ && (current_scene_->done() || Jg::quitting())) {
|
||||
game_state_ = current_scene_->nextState();
|
||||
current_scene_.reset();
|
||||
}
|
||||
@@ -216,7 +213,7 @@ auto Director::iterate() -> bool {
|
||||
// game_state_ i info::ctx. Si és impossible (game_state_ == -1,
|
||||
// quit, o state no registrat), eixim del loop.
|
||||
if (!current_scene_) {
|
||||
if (game_state_ == -1 || JG_Quitting()) {
|
||||
if (game_state_ == -1 || Jg::quitting()) {
|
||||
return false;
|
||||
}
|
||||
current_scene_ = createNextScene();
|
||||
@@ -227,9 +224,9 @@ auto Director::iterate() -> bool {
|
||||
last_tick_ms_ = SDL_GetTicks();
|
||||
}
|
||||
|
||||
// Tick de l'escena. JI_Update refresca key_pressed/any_key; el
|
||||
// Tick de l'escena. Ji::update refresca key_pressed/any_key; el
|
||||
// delta_ms és el temps real transcorregut des de l'últim tick.
|
||||
JI_Update();
|
||||
Ji::update();
|
||||
const Uint32 now = SDL_GetTicks();
|
||||
const int delta_ms = static_cast<int>(now - last_tick_ms_);
|
||||
last_tick_ms_ = now;
|
||||
@@ -266,7 +263,7 @@ void Director::teardown() {
|
||||
// Senyal de quit i descàrrega ordenada de l'escena en curs. Els
|
||||
// destructors de cada escena són no-bloquejants — ja no fan fades
|
||||
// bloquejants. La resta de cleanup la gestiona `destroy()`.
|
||||
JG_QuitSignal();
|
||||
Jg::quitSignal();
|
||||
current_scene_.reset();
|
||||
}
|
||||
|
||||
@@ -290,7 +287,7 @@ void Director::pollAllEvents() {
|
||||
|
||||
void Director::handleEvent(const SDL_Event& event) {
|
||||
if (event.type == SDL_EVENT_QUIT) {
|
||||
JG_QuitSignal();
|
||||
Jg::quitSignal();
|
||||
requestQuit();
|
||||
}
|
||||
// Hot-plug de gamepad (a Emscripten els dispositius web entren com
|
||||
@@ -325,7 +322,7 @@ void Director::handleEvent(const SDL_Event& event) {
|
||||
if (event.type == SDL_EVENT_KEY_DOWN && !event.key.repeat &&
|
||||
event.key.scancode == KeyConfig::scancode("menu_toggle")) {
|
||||
Menu::toggle();
|
||||
JI_SetInputBlocked(Menu::isOpen());
|
||||
Ji::setInputBlocked(Menu::isOpen());
|
||||
menu_keys_held_[event.key.scancode] = true;
|
||||
return;
|
||||
}
|
||||
@@ -333,14 +330,14 @@ void Director::handleEvent(const SDL_Event& event) {
|
||||
if (Menu::isOpen() && event.type == SDL_EVENT_KEY_DOWN && !event.key.repeat) {
|
||||
if (event.key.scancode == SDL_SCANCODE_ESCAPE) {
|
||||
Menu::close();
|
||||
JI_SetInputBlocked(false);
|
||||
Ji::setInputBlocked(false);
|
||||
// Empassa l'ESC fins al release perquè el joc no la veja per polling
|
||||
esc_swallow_until_release_ = true;
|
||||
} else {
|
||||
Menu::handleKey(event.key.scancode);
|
||||
// El menú pot haver-se tancat (p.ex. Backspace al nivell arrel)
|
||||
if (!Menu::isOpen()) {
|
||||
JI_SetInputBlocked(false);
|
||||
Ji::setInputBlocked(false);
|
||||
}
|
||||
}
|
||||
menu_keys_held_[event.key.scancode] = true;
|
||||
@@ -372,7 +369,7 @@ void Director::handleEvent(const SDL_Event& event) {
|
||||
// Segona pulsació: senyal d'eixida al joc
|
||||
esc_blocked_ = false;
|
||||
key_pressed_ = true;
|
||||
JG_QuitSignal();
|
||||
Jg::quitSignal();
|
||||
// Si estem en pausa, la desactivem: el fiber del joc està
|
||||
// congelat i necessita ser reprès per veure la senyal de
|
||||
// quit i poder tornar de forma natural.
|
||||
@@ -392,7 +389,7 @@ void Director::handleEvent(const SDL_Event& event) {
|
||||
const auto sc = event.key.scancode;
|
||||
if (!KeyConfig::isGuiKey(sc)) {
|
||||
key_pressed_ = true;
|
||||
JI_moveCheats(sc);
|
||||
Ji::moveCheats(sc);
|
||||
}
|
||||
}
|
||||
Mouse::handleEvent(event);
|
||||
@@ -400,7 +397,7 @@ void Director::handleEvent(const SDL_Event& event) {
|
||||
|
||||
void Director::requestQuit() {
|
||||
quit_requested_ = true;
|
||||
JG_QuitSignal();
|
||||
Jg::quitSignal();
|
||||
}
|
||||
|
||||
void Director::requestRestart() {
|
||||
|
||||
@@ -41,7 +41,7 @@ class Director {
|
||||
// iterate() per evitar manipular l'escena des d'una lambda del menú.
|
||||
void requestRestart();
|
||||
|
||||
// Consumeix el flag de "tecla polsada" (com l'antic JI_AnyKey)
|
||||
// Consumeix el flag de "tecla polsada" (com l'antic Ji::anyKey)
|
||||
auto consumeKeyPressed() -> bool;
|
||||
|
||||
// Indica si ESC està bloquejada (el joc no l'ha de veure)
|
||||
@@ -88,9 +88,9 @@ class Director {
|
||||
std::atomic<bool> esc_blocked_{false};
|
||||
std::atomic<bool> paused_{false};
|
||||
// Quan el menú tanca amb ESC, empassem-nos l'ESC fins que l'usuari la deixe anar,
|
||||
// per no fer eixir el joc al proper poll de JI_KeyPressed.
|
||||
// per no fer eixir el joc al proper poll de Ji::keyPressed.
|
||||
std::atomic<bool> esc_swallow_until_release_{false};
|
||||
// Tecles consumides pel menú (KEY_DOWN): el KEY_UP associat cal empassar-lo
|
||||
// per evitar que el joc (JI_AnyKey / JI_moveCheats) les veja quan el menú tanca.
|
||||
// per evitar que el joc (Ji::anyKey / Ji::moveCheats) les veja quan el menú tanca.
|
||||
bool menu_keys_held_[SDL_SCANCODE_COUNT]{};
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ void Bola::update() {
|
||||
}
|
||||
|
||||
// Augmentem el frame
|
||||
if (JG_GetCycleCounter() % this->cycles_per_frame == 0) {
|
||||
if (Jg::getCycleCounter() % this->cycles_per_frame == 0) {
|
||||
this->cur_frame++;
|
||||
if (this->cur_frame == entitat.animacions[this->o].frames.size()) {
|
||||
this->cur_frame = 0;
|
||||
|
||||
@@ -32,7 +32,7 @@ Engendro::Engendro(Jd8::Surface gfx, Uint16 x, Uint16 y)
|
||||
auto Engendro::update() -> bool {
|
||||
bool mort = false;
|
||||
|
||||
if (JG_GetCycleCounter() % this->cycles_per_frame == 0) {
|
||||
if (Jg::getCycleCounter() % this->cycles_per_frame == 0) {
|
||||
this->cur_frame++;
|
||||
if (this->cur_frame == entitat.animacions[this->o].frames.size()) {
|
||||
this->cur_frame = 0;
|
||||
|
||||
@@ -72,13 +72,13 @@ void Mapa::update() {
|
||||
}
|
||||
|
||||
if (this->porta_oberta && sam->x == 150 && sam->y == 30) {
|
||||
if (JI_KeyPressed(SDL_SCANCODE_UP)) {
|
||||
if (Ji::keyPressed(SDL_SCANCODE_UP)) {
|
||||
this->sam->o = 4;
|
||||
this->sam->y -= 15;
|
||||
}
|
||||
}
|
||||
|
||||
if (JG_GetCycleCounter() % 8 == 0) {
|
||||
if (Jg::getCycleCounter() % 8 == 0) {
|
||||
this->frame_torxes++;
|
||||
this->frame_torxes = this->frame_torxes % 4;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
ModuleGame::ModuleGame() {
|
||||
this->gfx_ = Jd8::loadSurface(info::ctx.pepe_activat ? "gfx/frames2.gif" : "gfx/frames.gif");
|
||||
JG_SetUpdateTicks(10);
|
||||
Jg::setUpdateTicks(10);
|
||||
|
||||
this->sam_ = std::make_unique<Prota>(this->gfx_);
|
||||
this->mapa_ = std::make_unique<Mapa>(this->gfx_, this->sam_.get());
|
||||
@@ -92,7 +92,7 @@ void ModuleGame::tick(int delta_ms) {
|
||||
}
|
||||
|
||||
auto ModuleGame::nextState() const -> int {
|
||||
if (JG_Quitting()) {
|
||||
if (Jg::quitting()) {
|
||||
return -1;
|
||||
}
|
||||
if (info::ctx.num_habitacio == 1 ||
|
||||
@@ -133,8 +133,8 @@ void ModuleGame::draw() {
|
||||
}
|
||||
|
||||
void ModuleGame::update() {
|
||||
if (JG_ShouldUpdate()) {
|
||||
JI_Update();
|
||||
if (Jg::shouldUpdate()) {
|
||||
Ji::update();
|
||||
|
||||
this->final_ = this->sam_->update();
|
||||
const auto erased = std::erase_if(this->momies_, [](auto& m) { return m->update(); });
|
||||
@@ -148,14 +148,14 @@ void ModuleGame::update() {
|
||||
info::ctx.momies++;
|
||||
}
|
||||
|
||||
if (JI_CheatActivated("reviu")) {
|
||||
if (Ji::cheatActivated("reviu")) {
|
||||
info::ctx.vida = 5;
|
||||
}
|
||||
if (JI_CheatActivated("alone")) {
|
||||
if (Ji::cheatActivated("alone")) {
|
||||
this->momies_.clear();
|
||||
info::ctx.momies = 0;
|
||||
}
|
||||
if (JI_CheatActivated("obert")) {
|
||||
if (Ji::cheatActivated("obert")) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
this->mapa_->tombes[i].costat[0] = true;
|
||||
this->mapa_->tombes[i].costat[1] = true;
|
||||
@@ -165,8 +165,8 @@ void ModuleGame::update() {
|
||||
}
|
||||
}
|
||||
|
||||
if (JI_KeyPressed(SDL_SCANCODE_ESCAPE)) {
|
||||
JG_QuitSignal();
|
||||
if (Ji::keyPressed(SDL_SCANCODE_ESCAPE)) {
|
||||
Jg::quitSignal();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
// Escena de gameplay pur. Reemplaça el vell `Go()` bloquejant amb
|
||||
// l'interfície `scenes::Scene` tick-based: `onEnter()` arranca la
|
||||
// música i un fade-in, el `tick()` avança un frame (Draw + Update
|
||||
// gated per JG_ShouldUpdate), i quan la partida acaba fa un fade-out
|
||||
// gated per Jg::shouldUpdate), i quan la partida acaba fa un fade-out
|
||||
// abans de retornar el next state.
|
||||
//
|
||||
// Tres fases internes:
|
||||
// 1. FADING_IN — fade-in 32 passos mentre el render segueix viu.
|
||||
// 2. Playing — gameplay normal; `final_` es setja quan el prota mor
|
||||
// o canvia de sala. `Update()` només avança cada 10 ms
|
||||
// via `JG_ShouldUpdate` (ticker fix del jail).
|
||||
// via `Jg::shouldUpdate` (ticker fix del jail).
|
||||
// 3. FADING_OUT — fade-out 32 passos mantenint l'últim frame visible
|
||||
// (substituïx el `JD8_FadeOut` bloquejant que feia el
|
||||
// destructor legacy).
|
||||
@@ -51,7 +51,7 @@ class ModuleGame : public scenes::Scene {
|
||||
};
|
||||
|
||||
void draw(); // render a `screen`; no crida Jd8::flip (ho fa el caller)
|
||||
void update(); // gated per JG_ShouldUpdate
|
||||
void update(); // gated per Jg::shouldUpdate
|
||||
|
||||
void iniciarMomies();
|
||||
void applyFinalTransitions() const; // muta info::ctx quan final_ passa a !=0
|
||||
|
||||
@@ -74,7 +74,7 @@ void Momia::draw() {
|
||||
Sprite::draw();
|
||||
|
||||
if (info::ctx.num_piramide == 4) {
|
||||
if ((JG_GetCycleCounter() % 40) < 20) {
|
||||
if ((Jg::getCycleCounter() % 40) < 20) {
|
||||
Jd8::blitCK(this->x, this->y, this->gfx, 220, 80, 15, 15, 255);
|
||||
} else {
|
||||
Jd8::blitCK(this->x, this->y, this->gfx, 235, 80, 15, 15, 255);
|
||||
@@ -93,7 +93,7 @@ auto Momia::update() -> bool {
|
||||
return morta;
|
||||
}
|
||||
|
||||
if (this->sam->o < 4 && (this->dimoni || info::ctx.num_piramide == 5 || JG_GetCycleCounter() % 2 == 0)) {
|
||||
if (this->sam->o < 4 && (this->dimoni || info::ctx.num_piramide == 5 || Jg::getCycleCounter() % 2 == 0)) {
|
||||
if ((this->x - 20) % 65 == 0 && (this->y - 30) % 35 == 0) {
|
||||
if (this->dimoni) {
|
||||
if (rand() % 2 == 0) {
|
||||
@@ -147,7 +147,7 @@ auto Momia::update() -> bool {
|
||||
break;
|
||||
}
|
||||
|
||||
if (JG_GetCycleCounter() % this->cycles_per_frame == 0) {
|
||||
if (Jg::getCycleCounter() % this->cycles_per_frame == 0) {
|
||||
this->cur_frame++;
|
||||
if (this->cur_frame == entitat.animacions[this->o].frames.size()) {
|
||||
this->cur_frame = 0;
|
||||
|
||||
@@ -91,7 +91,7 @@ void Prota::draw() {
|
||||
Sprite::draw();
|
||||
|
||||
if (info::ctx.num_piramide == 4 && this->o != 4) {
|
||||
if ((JG_GetCycleCounter() % 40) < 20) {
|
||||
if ((Jg::getCycleCounter() % 40) < 20) {
|
||||
Jd8::blitCK(this->x, this->y, this->gfx, 220, 80, 15, 15, 255);
|
||||
} else {
|
||||
Jd8::blitCK(this->x, this->y, this->gfx, 235, 80, 15, 15, 255);
|
||||
@@ -104,25 +104,25 @@ auto Prota::update() -> Uint8 {
|
||||
|
||||
if (this->o < 4) {
|
||||
Uint8 dir = 4;
|
||||
if (JI_KeyPressed(SDL_SCANCODE_DOWN)) {
|
||||
if (Ji::keyPressed(SDL_SCANCODE_DOWN)) {
|
||||
if ((this->x - 20) % 65 == 0) {
|
||||
this->o = 0;
|
||||
}
|
||||
dir = this->o;
|
||||
}
|
||||
if (JI_KeyPressed(SDL_SCANCODE_UP)) {
|
||||
if (Ji::keyPressed(SDL_SCANCODE_UP)) {
|
||||
if ((this->x - 20) % 65 == 0) {
|
||||
this->o = 1;
|
||||
}
|
||||
dir = this->o;
|
||||
}
|
||||
if (JI_KeyPressed(SDL_SCANCODE_RIGHT)) {
|
||||
if (Ji::keyPressed(SDL_SCANCODE_RIGHT)) {
|
||||
if ((this->y - 30) % 35 == 0) {
|
||||
this->o = 2;
|
||||
}
|
||||
dir = this->o;
|
||||
}
|
||||
if (JI_KeyPressed(SDL_SCANCODE_LEFT)) {
|
||||
if (Ji::keyPressed(SDL_SCANCODE_LEFT)) {
|
||||
if ((this->y - 30) % 35 == 0) {
|
||||
this->o = 3;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ auto Prota::update() -> Uint8 {
|
||||
if (this->frame_pejades == 15) {
|
||||
this->frame_pejades = 0;
|
||||
}
|
||||
if (JG_GetCycleCounter() % this->cycles_per_frame == 0) {
|
||||
if (Jg::getCycleCounter() % this->cycles_per_frame == 0) {
|
||||
this->cur_frame++;
|
||||
if (this->cur_frame == entitat.animacions[this->o].frames.size()) {
|
||||
this->cur_frame = 0;
|
||||
@@ -170,7 +170,7 @@ auto Prota::update() -> Uint8 {
|
||||
}
|
||||
eixir = 0U;
|
||||
} else {
|
||||
if (JG_GetCycleCounter() % this->cycles_per_frame == 0) {
|
||||
if (Jg::getCycleCounter() % this->cycles_per_frame == 0) {
|
||||
this->cur_frame++;
|
||||
if (this->cur_frame == entitat.animacions[this->o].frames.size()) {
|
||||
if (this->o == 4) {
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace scenes {
|
||||
break;
|
||||
|
||||
case Phase::Showing:
|
||||
if (JI_AnyKey()) {
|
||||
if (Ji::anyKey()) {
|
||||
remaining_ms_ = 0;
|
||||
} else {
|
||||
remaining_ms_ -= delta_ms;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace {
|
||||
};
|
||||
|
||||
constexpr int CONTADOR_MAX = 3100; // ~62 s de crèdits a 20 ms/tick
|
||||
constexpr int TICK_MS = 20; // JG_SetUpdateTicks heretat del doSlides previ
|
||||
constexpr int TICK_MS = 20; // Jg::setUpdateTicks heretat del doSlides previ
|
||||
constexpr int BG_INDEX = 255;
|
||||
|
||||
} // namespace
|
||||
@@ -111,7 +111,7 @@ namespace scenes {
|
||||
switch (phase_) {
|
||||
case Phase::Rolling: {
|
||||
// Avancem el contador en passos discrets de 20 ms, igual
|
||||
// que feia JG_ShouldUpdate(20) al vell doCredits.
|
||||
// que feia Jg::shouldUpdate(20) al vell doCredits.
|
||||
contador_acc_ms_ += delta_ms;
|
||||
while (contador_acc_ms_ >= TICK_MS) {
|
||||
contador_acc_ms_ -= TICK_MS;
|
||||
@@ -121,7 +121,7 @@ namespace scenes {
|
||||
coche_.tick(delta_ms);
|
||||
render();
|
||||
|
||||
if (JI_AnyKey() || contador_ >= CONTADOR_MAX) {
|
||||
if (Ji::anyKey() || contador_ >= CONTADOR_MAX) {
|
||||
writeTrickIni();
|
||||
fade_.startFadeOut();
|
||||
phase_ = Phase::FadingOut;
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace scenes {
|
||||
// TOTA la intro (inclou saltar la fase de sprites). Durant Sprites
|
||||
// deixem que la sub-escena gestione el seu propi skip (que a més
|
||||
// respecta la fase "final" no skippable de la variant 0).
|
||||
if (phase_ != Phase::Sprites && phase_ != Phase::Done && JI_AnyKey()) {
|
||||
if (phase_ != Phase::Sprites && phase_ != Phase::Done && Ji::anyKey()) {
|
||||
info::ctx.num_piramide = 0;
|
||||
phase_ = Phase::Done;
|
||||
return;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
// Timings idèntics als del vell `doIntro()`: el JG_SetUpdateTicks(1000)
|
||||
// Timings idèntics als del vell `doIntro()`: el Jg::setUpdateTicks(1000)
|
||||
// inicial, (100) per a les 3 primeres lletres (J, A, I), (200) per a
|
||||
// "JAIL" i el seu clear, (100) per a les 4 lletres centrals
|
||||
// (G, A, M, E) i (200) per a la resta fins al cicle de paleta.
|
||||
@@ -152,7 +152,7 @@ namespace scenes {
|
||||
// (inclou saltar la fase de sprites). Durant Sprites deixem que
|
||||
// la sub-escena gestione el seu propi skip internament, que a més
|
||||
// respecta la fase "final" no skippable de la variant 0.
|
||||
if (phase_ != Phase::Sprites && phase_ != Phase::Done && JI_AnyKey()) {
|
||||
if (phase_ != Phase::Sprites && phase_ != Phase::Done && Ji::anyKey()) {
|
||||
info::ctx.num_piramide = 0;
|
||||
phase_ = Phase::Done;
|
||||
return;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
// Duració d'un pas. El vell doIntroSprites feia JG_SetUpdateTicks(20);
|
||||
// Duració d'un pas. El vell doIntroSprites feia Jg::setUpdateTicks(20);
|
||||
// cada iteració del seu for (i) consumia un tick de 20 ms.
|
||||
constexpr int TICK_MS = 20;
|
||||
|
||||
@@ -346,7 +346,7 @@ namespace scenes {
|
||||
// Skip per tecla. Durant la fase marcada com a no skippable (només
|
||||
// v0Final al vell codi) s'ignora — preserva la semàntica del vell
|
||||
// bucle final de la variant 0 que no cridava wait_frame_or_skip.
|
||||
if (phases[phase_].skippable && JI_AnyKey()) {
|
||||
if (phases[phase_].skippable && Ji::anyKey()) {
|
||||
done_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -98,9 +98,9 @@ namespace scenes {
|
||||
// Qualsevol tecla tanca el menú. Llegim 'P' explícitament abans
|
||||
// de reiniciar el flag de input perquè `info::ctx.pepe_activat`
|
||||
// reflecteixca si l'usuari estava polsant P al moment d'eixir.
|
||||
if (JI_AnyKey() || JI_KeyPressed(SDL_SCANCODE_P)) {
|
||||
info::ctx.pepe_activat = JI_KeyPressed(SDL_SCANCODE_P);
|
||||
JI_DisableKeyboard(60);
|
||||
if (Ji::anyKey() || Ji::keyPressed(SDL_SCANCODE_P)) {
|
||||
info::ctx.pepe_activat = Ji::keyPressed(SDL_SCANCODE_P);
|
||||
Ji::disableKeyboard(60);
|
||||
info::ctx.num_piramide = 1;
|
||||
fade_.startFadeOut();
|
||||
phase_ = Phase::FadingOut;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace scenes {
|
||||
|
||||
void MortScene::onEnter() {
|
||||
playMusic("music/mort.ogg");
|
||||
JI_DisableKeyboard(60);
|
||||
Ji::disableKeyboard(60);
|
||||
info::ctx.vida = 5;
|
||||
|
||||
gfx_ = SurfaceHandle("gfx/gameover.gif");
|
||||
@@ -38,7 +38,7 @@ namespace scenes {
|
||||
break;
|
||||
|
||||
case Phase::Showing:
|
||||
if (JI_AnyKey()) {
|
||||
if (Ji::anyKey()) {
|
||||
remaining_ms_ = 0;
|
||||
} else {
|
||||
remaining_ms_ -= delta_ms;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr int TICK_MS = 20; // JG_SetUpdateTicks(20) del vell doSecreta
|
||||
constexpr int TICK_MS = 20; // Jg::setUpdateTicks(20) del vell doSecreta
|
||||
|
||||
// Durades per fase, derivades dels contador-thresholds del vell:
|
||||
// tomba1 scroll: 127 passos (contador 1→128) × 20ms
|
||||
@@ -85,7 +85,7 @@ namespace scenes {
|
||||
// Skip per tecla (després del fade inicial, no mentre). Salta
|
||||
// directament al FinalFadeOut. Mateix patró que el vell, on
|
||||
// qualsevol tecla sortia del loop.
|
||||
if (!skip_triggered_ && phase_ != Phase::InitialFadeOut && JI_AnyKey()) {
|
||||
if (!skip_triggered_ && phase_ != Phase::InitialFadeOut && Ji::anyKey()) {
|
||||
skip_triggered_ = true;
|
||||
beginFinalFade();
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace scenes {
|
||||
// Skip: qualsevol tecla salta directament al fade final. Per fidelitat
|
||||
// al vell doSlides, el skip NO atura la música explícitament — només
|
||||
// el final natural crida Ja::fadeOutMusic (beginFinalFade() distingeix).
|
||||
if (!skip_triggered_ && JI_AnyKey()) {
|
||||
if (!skip_triggered_ && Ji::anyKey()) {
|
||||
skip_triggered_ = true;
|
||||
if (num_piramide_at_start_ != 7) {
|
||||
Audio::get()->fadeOutMusic(250);
|
||||
|
||||
+2
-2
@@ -89,7 +89,7 @@ auto SDL_AppInit(void** /*appstate*/, int /*argc*/, char* /*argv*/[]) -> SDL_App
|
||||
Options::setCrtPiFile(std::string(file_getconfigfolder()) + "crtpi.yaml");
|
||||
Options::loadCrtPiFromFile();
|
||||
|
||||
JG_Init();
|
||||
Jg::init();
|
||||
Screen::init();
|
||||
Jd8::init();
|
||||
Audio::init(); // crida internament Ja::init i aplica Options::audio
|
||||
@@ -149,6 +149,6 @@ void SDL_AppQuit(void* /*appstate*/, SDL_AppResult /*result*/) {
|
||||
Audio::destroy(); // el destructor del singleton crida Ja::quit
|
||||
Jd8::quit();
|
||||
Screen::destroy();
|
||||
JG_Finalize();
|
||||
Jg::finalize();
|
||||
ResourceHelper::shutdownResourceSystem();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user