File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -210,18 +210,17 @@ bool JoystickSDL::_update()
210210bool JoystickSDL::_getButton (int idx) const
211211{
212212 // First try the standardized gamepad set if idx is inside that set
213- #ifdef SDL_GAMEPAD_BUTTON_COUNT
214- if (_sdlGamepad && idx >= 0 && idx < SDL_GAMEPAD_BUTTON_COUNT) {
215- if (SDL_GetGamepadButton (_sdlGamepad,
216- static_cast <SDL_GamepadButton>(idx)) == 1 ) {
213+ if (_sdlGamepad && (idx >= 0 ) && (idx < SDL_GAMEPAD_BUTTON_COUNT)) {
214+ if (SDL_GetGamepadButton (_sdlGamepad, static_cast <SDL_GamepadButton>(idx))) {
217215 return true ;
218216 }
219217 }
220- # endif
218+
221219 // Fall back to raw joystick buttons (covers unmapped/extras)
222- if (_sdlJoystick && idx >= 0 && idx < SDL_GetNumJoystickButtons (_sdlJoystick)) {
223- return SDL_GetJoystickButton (_sdlJoystick, idx) == 1 ;
220+ if (_sdlJoystick && ( idx >= 0 ) && ( idx < SDL_GetNumJoystickButtons (_sdlJoystick) )) {
221+ return SDL_GetJoystickButton (_sdlJoystick, idx);
224222 }
223+
225224 return false ;
226225}
227226
You can’t perform that action at this time.
0 commit comments