From 3d5277a3953557244c35242533ad4911c510a698 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Wed, 17 Dec 2025 18:36:12 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20ratol=C3=AD=20visible=20en=20fullscreen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/core/graphics/vector_text.cpp | 3 +-- source/core/input/mouse.cpp | 12 +++++------- source/game/escenes/escena_joc.cpp | 8 ++++---- source/game/escenes/escena_joc.hpp | 16 ++++++++-------- source/game/stage_system/stage_config.hpp | 2 +- 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/source/core/graphics/vector_text.cpp b/source/core/graphics/vector_text.cpp index 19a5174..dbcde6b 100644 --- a/source/core/graphics/vector_text.cpp +++ b/source/core/graphics/vector_text.cpp @@ -245,8 +245,7 @@ void VectorText::render_centered(const std::string& text, const Punt& centre_pun // restant la meitat de les dimensions del punt central Punt posicio_esquerra = { centre_punt.x - (text_width / 2.0f), - centre_punt.y - (text_height / 2.0f) - }; + centre_punt.y - (text_height / 2.0f)}; // Delegar al mètode render() existent render(text, posicio_esquerra, escala, spacing, brightness); diff --git a/source/core/input/mouse.cpp b/source/core/input/mouse.cpp index e8d84c7..8730d40 100644 --- a/source/core/input/mouse.cpp +++ b/source/core/input/mouse.cpp @@ -32,15 +32,13 @@ void setForceHidden(bool force) { if (force) { // Entrando en modo oculto forzado: ocultar cursor inmediatamente - if (cursor_visible) { - SDL_HideCursor(); - cursor_visible = false; - } + SDL_HideCursor(); + cursor_visible = false; } else { - // Saliendo de modo oculto forzado: mostrar cursor y resetear temporizador - SDL_ShowCursor(); - cursor_visible = true; + // Saliendo de modo oculto forzado: NO mostrar cursor automáticamente + // El cursor permanece oculto hasta que haya movimiento de ratón (handleEvent) last_mouse_move_time = SDL_GetTicks(); // Resetear temporizador + // cursor_visible permanece false - handleEvent lo cambiará al detectar movimiento } } diff --git a/source/game/escenes/escena_joc.cpp b/source/game/escenes/escena_joc.cpp index 4705f27..6a92c02 100644 --- a/source/game/escenes/escena_joc.cpp +++ b/source/game/escenes/escena_joc.cpp @@ -241,8 +241,8 @@ void EscenaJoc::actualitzar(float delta_time) { // Only allow join if there's an active game if (algun_jugador_viu) { // P2 can join if not currently playing (never joined OR dead without lives) - bool p2_no_juga = !config_partida_.jugador2_actiu || // Never joined - itocado_per_jugador_[1] == 999.0f; // Dead without lives + bool p2_no_juga = !config_partida_.jugador2_actiu || // Never joined + itocado_per_jugador_[1] == 999.0f; // Dead without lives if (p2_no_juga) { if (input->checkActionPlayer2(InputAction::START, Input::DO_NOT_ALLOW_REPEAT)) { @@ -251,8 +251,8 @@ void EscenaJoc::actualitzar(float delta_time) { } // P1 can join if not currently playing (never joined OR dead without lives) - bool p1_no_juga = !config_partida_.jugador1_actiu || // Never joined - itocado_per_jugador_[0] == 999.0f; // Dead without lives + bool p1_no_juga = !config_partida_.jugador1_actiu || // Never joined + itocado_per_jugador_[0] == 999.0f; // Dead without lives if (p1_no_juga) { if (input->checkActionPlayer1(InputAction::START, Input::DO_NOT_ALLOW_REPEAT)) { diff --git a/source/game/escenes/escena_joc.hpp b/source/game/escenes/escena_joc.hpp index c764943..c2def11 100644 --- a/source/game/escenes/escena_joc.hpp +++ b/source/game/escenes/escena_joc.hpp @@ -26,9 +26,9 @@ // Game over state machine enum class EstatGameOver { - NONE, // Normal gameplay - CONTINUE, // Continue countdown screen (9→0) - GAME_OVER // Final game over (returning to title) + NONE, // Normal gameplay + CONTINUE, // Continue countdown screen (9→0) + GAME_OVER // Final game over (returning to title) }; // Classe principal del joc (escena) @@ -89,11 +89,11 @@ class EscenaJoc { Punt obtenir_punt_spawn(uint8_t player_id) const; // Get spawn position for player // [NEW] Continue & Join system - void unir_jugador(uint8_t player_id); // Join inactive player mid-game - void processar_input_continue(); // Handle input during continue screen - void actualitzar_continue(float delta_time); // Update continue countdown - void check_and_apply_continue_timeout(); // Check if continue timed out and transition to GAME_OVER - void dibuixar_continue(); // Draw continue screen + void unir_jugador(uint8_t player_id); // Join inactive player mid-game + void processar_input_continue(); // Handle input during continue screen + void actualitzar_continue(float delta_time); // Update continue countdown + void check_and_apply_continue_timeout(); // Check if continue timed out and transition to GAME_OVER + void dibuixar_continue(); // Draw continue screen // [NEW] Stage system helpers void dibuixar_missatge_stage(const std::string& missatge); diff --git a/source/game/stage_system/stage_config.hpp b/source/game/stage_system/stage_config.hpp index f8bd760..ad167a7 100644 --- a/source/game/stage_system/stage_config.hpp +++ b/source/game/stage_system/stage_config.hpp @@ -29,7 +29,7 @@ struct DistribucioEnemics { uint8_t pentagon; // 0-100 uint8_t quadrat; // 0-100 uint8_t molinillo; // 0-100 - // Suma ha de ser 100, validat en StageLoader + // Suma ha de ser 100, validat en StageLoader }; // Multiplicadors de dificultat