getButton method

bool getButton(
  1. int button
)

Get the current state of a button on a gamepad.

\param gamepad a gamepad. \param button a button index (one of the SDL_GamepadButton values). \returns true if the button is pressed, false otherwise.

\since This function is available since SDL 3.1.3.

\sa SDL_GamepadHasButton \sa SDL_GetGamepadAxis

extern SDL_DECLSPEC bool SDLCALL SDL_GetGamepadButton(SDL_Gamepad *gamepad, SDL_GamepadButton button)

Implementation

bool getButton(int button) {
  return sdlGetGamepadButton(this, button);
}