sdlGamepadHasButton function gamepad

bool sdlGamepadHasButton(
  1. Pointer<SdlGamepad> gamepad,
  2. int button
)

Query whether a gamepad has a given button.

This merely reports whether the gamepad's mapping defined this button, as that is all the information SDL has about the physical device.

\param gamepad a gamepad. \param button a button enum value (an SDL_GamepadButton value). \returns true if the gamepad has this button, 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_GamepadHasAxis

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

Implementation

bool sdlGamepadHasButton(Pointer<SdlGamepad> gamepad, int button) {
  final sdlGamepadHasButtonLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(Pointer<SdlGamepad> gamepad, Int32 button),
        int Function(Pointer<SdlGamepad> gamepad, int button)
      >('SDL_GamepadHasButton');
  return sdlGamepadHasButtonLookupFunction(gamepad, button) == 1;
}