sdlSetGamepadPlayerIndex function

bool sdlSetGamepadPlayerIndex(
  1. Pointer<SdlGamepad> gamepad,
  2. int playerIndex
)

Set the player index of an opened gamepad.

\param gamepad the gamepad object to adjust. \param player_index player index to assign to this gamepad, or -1 to clear the player index and turn off player LEDs. \returns true on success or false on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_GetGamepadPlayerIndex

extern SDL_DECLSPEC bool SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index)

Implementation

bool sdlSetGamepadPlayerIndex(Pointer<SdlGamepad> gamepad, int playerIndex) {
  final sdlSetGamepadPlayerIndexLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlGamepad> gamepad, Int32 playerIndex),
      int Function(Pointer<SdlGamepad> gamepad,
          int playerIndex)>('SDL_SetGamepadPlayerIndex');
  return sdlSetGamepadPlayerIndexLookupFunction(gamepad, playerIndex) == 1;
}