sdlGetJoystickButton function joystick
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 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_GetNumJoystickButtons
extern SDL_DECLSPEC bool SDLCALL SDL_GetJoystickButton(SDL_Joystick *joystick, int button)
Implementation
bool sdlGetJoystickButton(Pointer<SdlJoystick> joystick, int button) {
final sdlGetJoystickButtonLookupFunction = _libSdl
.lookupFunction<
Uint8 Function(Pointer<SdlJoystick> joystick, Int32 button),
int Function(Pointer<SdlJoystick> joystick, int button)
>('SDL_GetJoystickButton');
return sdlGetJoystickButtonLookupFunction(joystick, button) == 1;
}