getPlayerIndexForId static method

int getPlayerIndexForId(
  1. int instanceId
)

Get the player index of a gamepad.

This can be called before any gamepads are opened.

\param instance_id the joystick instance ID. \returns the player index of a gamepad, or -1 if it's not available.

\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_GetGamepads

extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadPlayerIndexForID(SDL_JoystickID instance_id)

{@category gamepad}

Implementation

static int getPlayerIndexForId(int instanceId) =>
    sdlGetGamepadPlayerIndexForId(instanceId);