sdlGetGamepadPlayerIndexForId function

int sdlGetGamepadPlayerIndexForId(
  1. int instanceId
)

Get the player index of a gamepad.

This can be called before any gamepads are opened.

\param instance_id the joystick instance ID. \returns the player index of a gamepad, or -1 if it's not available.

\since This function is available since SDL 3.1.3.

\sa SDL_GetGamepadPlayerIndex \sa SDL_GetGamepads

extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadPlayerIndexForID(SDL_JoystickID instance_id)

Implementation

int sdlGetGamepadPlayerIndexForId(int instanceId) {
  final sdlGetGamepadPlayerIndexForIdLookupFunction = libSdl3.lookupFunction<
      Int32 Function(Uint32 instanceId),
      int Function(int instanceId)>('SDL_GetGamepadPlayerIndexForID');
  return sdlGetGamepadPlayerIndexForIdLookupFunction(instanceId);
}