diff --git a/source/core/system/director.cpp b/source/core/system/director.cpp index e5308d5..f1ab997 100644 --- a/source/core/system/director.cpp +++ b/source/core/system/director.cpp @@ -395,10 +395,15 @@ auto Director::iterate() -> SDL_AppResult { if (const auto* notifier = System::Notifier::get(); notifier != nullptr) { notifier->draw(); // toast: per damunt de tot } - if (const auto* menu = System::ServiceMenu::get(); menu != nullptr) { + // Mentre l'overlay de redefinicio esta actiu, amaguem el menu de servei + // (encara queda "open" per a absorbir events un cop el modal s'auto-tanqui, + // pero no es pinta per no confondre's visualment amb el modal). + const auto* di = System::DefineInputs::get(); + const bool DEFINE_ACTIVE = (di != nullptr) && di->isActive(); + if (const auto* menu = System::ServiceMenu::get(); menu != nullptr && !DEFINE_ACTIVE) { menu->draw(); // service menu: per damunt fins i tot dels toasts } - if (const auto* di = System::DefineInputs::get(); di != nullptr) { + if (di != nullptr) { di->draw(); // overlay de rebind: per damunt de tot } sdl_->present(); diff --git a/source/game/scenes/title_scene.cpp b/source/game/scenes/title_scene.cpp index 238c1bf..520bfb0 100644 --- a/source/game/scenes/title_scene.cpp +++ b/source/game/scenes/title_scene.cpp @@ -13,6 +13,7 @@ #include "core/audio/audio.hpp" #include "core/defaults.hpp" #include "core/graphics/shape_loader.hpp" +#include "core/input/define_inputs.hpp" #include "core/input/input.hpp" #include "core/locale/locale.hpp" #include "core/math/easing.hpp" @@ -295,13 +296,6 @@ auto TitleScene::isFinished() const -> bool { } void TitleScene::update(float delta_time) { - // Pausa global: mentre el menu de servei esta obert (i, per tant, el - // sub-overlay de rebind tambe, si esta actiu), congelem la logica de la - // pantalla de titol per no consumir un START fantasma quan l'overlay - // s'auto-tanca i les tecles encara s'estan pulsant. - if (const auto* menu = System::ServiceMenu::get(); menu != nullptr && menu->isOpen()) { - return; - } if (starfield_) { starfield_->update(delta_time); } @@ -332,8 +326,20 @@ void TitleScene::update(float delta_time) { break; } - handleSkipInput(); - handleStartInput(); + // Les animacions segueixen pero els inputs es bloquegen mentre el menu + // de servei o l'overlay de redefinicio estiguin actius: en cas contrari, + // SDL_GetKeyboardState i SDL_GetGamepadButton segueixen veient les tecles + // pulsades i podrien disparar handleSkipInput/handleStartInput sense + // intencio. Mateixa logica: per a GameScene tota la pausa es global, + // pero a TitleScene nomes guardem els polls d'input. + const auto* menu = System::ServiceMenu::get(); + const auto* di = System::DefineInputs::get(); + const bool INPUT_BLOCKED = (menu != nullptr && menu->isOpen()) || + (di != nullptr && di->isActive()); + if (!INPUT_BLOCKED) { + handleSkipInput(); + handleStartInput(); + } } void TitleScene::updateStarfieldFadeInState(float delta_time) {