sdlGameControllerGetButton function

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

Get the current state of a button on a game controller.

\param gamecontroller a game controller \param button a button index (one of the SDL_GameControllerButton values) \returns 1 for pressed state or 0 for not pressed state or error; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_GameControllerGetAxis

extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button)

Implementation

int sdlGameControllerGetButton(
    Pointer<SdlGameController> gamecontroller, int button) {
  final sdlGameControllerGetButtonLookupFunction = libSdl2.lookupFunction<
      Uint8 Function(Pointer<SdlGameController> gamecontroller, Int32 button),
      int Function(Pointer<SdlGameController> gamecontroller,
          int button)>('SDL_GameControllerGetButton');
  return sdlGameControllerGetButtonLookupFunction(gamecontroller, button);
}