sdlGameControllerGetJoystick function
Get the Joystick ID from a Game Controller.
This function will give you a SDL_Joystick object, which allows you to use the SDL_Joystick functions with a SDL_GameController 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_GameController. You should not call SDL_JoystickClose() on it, for example, since doing so will likely cause SDL to crash.
\param gamecontroller the game controller object that you want to get a joystick from \returns a SDL_Joystick object; call SDL_GetError() for more information.
\since This function is available since SDL 2.0.0.
extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller)
Implementation
Pointer<SdlJoystick> sdlGameControllerGetJoystick(
Pointer<SdlGameController> gamecontroller) {
final sdlGameControllerGetJoystickLookupFunction = libSdl2.lookupFunction<
Pointer<SdlJoystick> Function(Pointer<SdlGameController> gamecontroller),
Pointer<SdlJoystick> Function(
Pointer<SdlGameController>
gamecontroller)>('SDL_GameControllerGetJoystick');
return sdlGameControllerGetJoystickLookupFunction(gamecontroller);
}