feat(service_menu): pagina CONTROLS amb assignacio de pad i rebind per jugador
Afegeix submenu CONTROLS al menu de servei amb 2 items CYCLE per seleccionar el mando assignat a cada jugador (persistit per name + path) i 4 items ACTION per arrancar DefineInputs (teclat/mando per a P1/P2). Tambe afegeix: - Director: init/update/draw/destroy del singleton DefineInputs. - GlobalEvents: routing prioritari de tots els events a DefineInputs mentre l'overlay esta actiu. - Locale ca/en: claus del submenu CONTROLS i de l'overlay de rebind. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "core/input/define_inputs.hpp"
|
||||
#include "core/input/input.hpp"
|
||||
#include "core/input/mouse.hpp"
|
||||
#include "core/locale/locale.hpp"
|
||||
@@ -43,6 +44,16 @@ namespace GlobalEvents {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Si l'overlay de redefinicio esta actiu, engoleix tots els events.
|
||||
auto consumeIfDefineActive(const SDL_Event& event) -> bool {
|
||||
auto* di = System::DefineInputs::get();
|
||||
if (di == nullptr || !di->isActive()) {
|
||||
return false;
|
||||
}
|
||||
di->handleEvent(event);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Botó MENU al mando d'algun jugador → alterna el menú de servei
|
||||
// (mateix comportament que F12 al teclat). Retorna true si l'event és
|
||||
// un GAMEPAD_BUTTON_DOWN consumit.
|
||||
@@ -83,6 +94,12 @@ namespace GlobalEvents {
|
||||
std::cout << "[Input] " << event_msg << '\n';
|
||||
}
|
||||
|
||||
// 1b. Si l'overlay de redefinicio esta actiu, engoleix tots els events
|
||||
// (cap arriba al joc, al menu de servei ni als hotkeys F1-F12).
|
||||
if (consumeIfDefineActive(event)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 2. Procesar SDL_EVENT_QUIT directamente (no es input de juego)
|
||||
if (event.type == SDL_EVENT_QUIT) {
|
||||
context.setNextScene(SceneType::EXIT);
|
||||
|
||||
Reference in New Issue
Block a user