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.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.2.0.

\sa SDL_GamepadHasButton \sa SDL_GetGamepadAxis

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

{@category gamepad}

Implementation

bool getButton(int button) => sdlGetGamepadButton(this, button);