sdlGameControllerHasButton function

bool sdlGameControllerHasButton(
  1. Pointer<SdlGameController> gamecontroller,
  2. int button
)

Query whether a game controller has a given button.

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

\param gamecontroller a game controller \param button a button enum value (an SDL_GameControllerButton value) \returns SDL_TRUE if the controller has this button, SDL_FALSE otherwise.

\since This function is available since SDL 2.0.14.

extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button)

Implementation

bool sdlGameControllerHasButton(
    Pointer<SdlGameController> gamecontroller, int button) {
  final sdlGameControllerHasButtonLookupFunction = libSdl2.lookupFunction<
      Int32 Function(Pointer<SdlGameController> gamecontroller, Int32 button),
      int Function(Pointer<SdlGameController> gamecontroller,
          int button)>('SDL_GameControllerHasButton');
  return sdlGameControllerHasButtonLookupFunction(gamecontroller, button) == 1;
}