sdlGetGamepadPlayerIndex function

int sdlGetGamepadPlayerIndex(
  1. Pointer<SdlGamepad> gamepad
)

Get the player index of an opened gamepad.

For XInput gamepads this returns the XInput user index.

\param gamepad the gamepad object to query. \returns the player index for gamepad, or -1 if it's not available.

\since This function is available since SDL 3.1.3.

\sa SDL_SetGamepadPlayerIndex

extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadPlayerIndex(SDL_Gamepad *gamepad)

Implementation

int sdlGetGamepadPlayerIndex(Pointer<SdlGamepad> gamepad) {
  final sdlGetGamepadPlayerIndexLookupFunction = libSdl3.lookupFunction<
      Int32 Function(Pointer<SdlGamepad> gamepad),
      int Function(Pointer<SdlGamepad> gamepad)>('SDL_GetGamepadPlayerIndex');
  return sdlGetGamepadPlayerIndexLookupFunction(gamepad);
}