---
name: "SDL_GetGamepadPlayerIndex"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_GetGamepadPlayerIndex"
---

# SDL\_GetGamepadPlayerIndex(3)

Get the player index of an opened gamepad.

## NAME

SDL\_GetGamepadPlayerIndex - Get the player index of an opened gamepad.

## HEADER FILE

Defined in SDL3/SDL\_gamepad.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**int SDL\_GetGamepadPlayerIndex(SDL\_Gamepad \*gamepad);**

## DESCRIPTION

For XInput gamepads this returns the XInput user index.

## FUNCTION PARAMETERS

- *gamepad*

  the gamepad object to query.

## RETURN VALUE

Returns the player index for gamepad, or -1 if it's not available.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_SetGamepadPlayerIndex**(3)](/SDL_SetGamepadPlayerIndex/3.md)
