SDLControllerInterface: Prefer cbutton.which for button events

Functionally the same as caxis.which due to SDL_Event union, but prefer
using SDL_ControllerButtonEvent members for button events.
This commit is contained in:
Albert Liu 2020-06-30 07:51:52 -07:00
parent d996f46618
commit 0a0a2024fd

View file

@ -319,7 +319,7 @@ bool SDLControllerInterface::HandleControllerButtonEvent(const SDL_Event* ev)
Log_DebugPrintf("controller %d button %d %s", ev->cbutton.which, ev->cbutton.button, Log_DebugPrintf("controller %d button %d %s", ev->cbutton.which, ev->cbutton.button,
ev->cbutton.state == SDL_PRESSED ? "pressed" : "released"); ev->cbutton.state == SDL_PRESSED ? "pressed" : "released");
auto it = GetControllerDataForJoystickId(ev->caxis.which); auto it = GetControllerDataForJoystickId(ev->cbutton.which);
if (it == m_controllers.end()) if (it == m_controllers.end())
return false; return false;