sdlGameControllerGetPlayerIndex function

int sdlGameControllerGetPlayerIndex(
  1. Pointer<SdlGameController> gamecontroller
)

Get the player index of an opened game controller.

For XInput controllers this returns the XInput user index.

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

\since This function is available since SDL 2.0.9.

extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller)

Implementation

int sdlGameControllerGetPlayerIndex(Pointer<SdlGameController> gamecontroller) {
  final sdlGameControllerGetPlayerIndexLookupFunction = libSdl2.lookupFunction<
          Int32 Function(Pointer<SdlGameController> gamecontroller),
          int Function(Pointer<SdlGameController> gamecontroller)>(
      'SDL_GameControllerGetPlayerIndex');
  return sdlGameControllerGetPlayerIndexLookupFunction(gamecontroller);
}