sdlGetGamepadFromPlayerIndex function gamepad

Pointer<SdlGamepad> sdlGetGamepadFromPlayerIndex(
  1. int playerIndex
)

Get the SDL_Gamepad associated with a player index.

\param player_index the player index, which different from the instance ID. \returns the SDL_Gamepad associated with a player index.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.2.0.

\sa SDL_GetGamepadPlayerIndex \sa SDL_SetGamepadPlayerIndex

extern SDL_DECLSPEC SDL_Gamepad * SDLCALL SDL_GetGamepadFromPlayerIndex(int player_index)

Implementation

Pointer<SdlGamepad> sdlGetGamepadFromPlayerIndex(int playerIndex) {
  final sdlGetGamepadFromPlayerIndexLookupFunction = _libSdl
      .lookupFunction<
        Pointer<SdlGamepad> Function(Int32 playerIndex),
        Pointer<SdlGamepad> Function(int playerIndex)
      >('SDL_GetGamepadFromPlayerIndex');
  return sdlGetGamepadFromPlayerIndexLookupFunction(playerIndex);
}