sdlSetJoystickPlayerIndex function joystick

bool sdlSetJoystickPlayerIndex(
  1. Pointer<SdlJoystick> joystick,
  2. int playerIndex
)

Set the player index of an opened joystick.

\param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). \param player_index player index to assign to this joystick, 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.

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

\since This function is available since SDL 3.2.0.

\sa SDL_GetJoystickPlayerIndex

extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickPlayerIndex(SDL_Joystick *joystick, int player_index)

Implementation

bool sdlSetJoystickPlayerIndex(Pointer<SdlJoystick> joystick, int playerIndex) {
  final sdlSetJoystickPlayerIndexLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(Pointer<SdlJoystick> joystick, Int32 playerIndex),
        int Function(Pointer<SdlJoystick> joystick, int playerIndex)
      >('SDL_SetJoystickPlayerIndex');
  return sdlSetJoystickPlayerIndexLookupFunction(joystick, playerIndex) == 1;
}