sdlJoystickGetButton function

int sdlJoystickGetButton(
  1. Pointer<SdlJoystick> joystick,
  2. int button
)

Get the current state of a button on a joystick.

\param joystick an SDL_Joystick structure containing joystick information \param button the button index to get the state from; indices start at index 0 \returns 1 if the specified button is pressed, 0 otherwise.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickNumButtons

extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button)

Implementation

int sdlJoystickGetButton(Pointer<SdlJoystick> joystick, int button) {
  final sdlJoystickGetButtonLookupFunction = libSdl2.lookupFunction<
      Uint8 Function(Pointer<SdlJoystick> joystick, Int32 button),
      int Function(
          Pointer<SdlJoystick> joystick, int button)>('SDL_JoystickGetButton');
  return sdlJoystickGetButtonLookupFunction(joystick, button);
}