fix(title): manten animacions amb menu obert, bloqueja nomes els polls d'input

El fix anterior pausava tot el title quan el menu de servei estava obert,
trencant l'efecte d'animacio de fons. Ara title segueix animant-se i
nomes guardem handleSkipInput/handleStartInput mentre el menu o el modal
de rebind estan actius, per evitar START fantasma sense congelar el render.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-24 20:54:04 +02:00
parent a4b567588f
commit 64a6599e81
2 changed files with 22 additions and 11 deletions
+7 -2
View File
@@ -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();
+15 -9
View File
@@ -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) {