soport de gamepad per a wasm

This commit is contained in:
2026-04-13 13:20:50 +02:00
parent d9c41f420b
commit 7f470361cc
15 changed files with 128 additions and 32 deletions

View File

@@ -92,6 +92,15 @@ void Title::handleEvent(const SDL_Event& event) {
return; // No procesar más este evento
}
// Qualsevol botó del comandament al menú principal inicia partida directament
// (els bindings ja estan definits, no cal "pulsar 1" amb el teclat).
if (event.type == SDL_EVENT_GAMEPAD_BUTTON_DOWN &&
state_ == State::MAIN_MENU &&
!is_remapping_keyboard_ && !is_remapping_joystick_) {
handleMainMenuKeyPress(SDLK_1); // PLAY
return;
}
if (event.type == SDL_EVENT_KEY_DOWN && !Console::get()->isActive()) {
// Si estamos en modo remap de teclado, capturar tecla
if (is_remapping_keyboard_ && !remap_completed_) {