sdlGetGamepadJoystick function gamepad
Get the underlying joystick from a gamepad.
This function will give you a SDL_Joystick object, which allows you to use the SDL_Joystick functions with a SDL_Gamepad object. This would be useful for getting a joystick's position at any given time, even if it hasn't moved (moving it would produce an event, which would have the axis' value).
The pointer returned is owned by the SDL_Gamepad. You should not call SDL_CloseJoystick() on it, for example, since doing so will likely cause SDL to crash.
\param gamepad the gamepad object that you want to get a joystick from. \returns an SDL_Joystick object, or NULL on failure; call SDL_GetError() for more information.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL 3.2.0.
extern SDL_DECLSPEC SDL_Joystick * SDLCALL SDL_GetGamepadJoystick(SDL_Gamepad *gamepad)
Implementation
Pointer<SdlJoystick> sdlGetGamepadJoystick(Pointer<SdlGamepad> gamepad) {
final sdlGetGamepadJoystickLookupFunction = _libSdl
.lookupFunction<
Pointer<SdlJoystick> Function(Pointer<SdlGamepad> gamepad),
Pointer<SdlJoystick> Function(Pointer<SdlGamepad> gamepad)
>('SDL_GetGamepadJoystick');
return sdlGetGamepadJoystickLookupFunction(gamepad);
}