---
name: "SDL_GetGamepadAxis"
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_GetGamepadAxis"
---

# SDL\_GetGamepadAxis(3)

Get the current state of an axis control on a gamepad.

## NAME

SDL\_GetGamepadAxis - Get the current state of an axis control on a gamepad.

## HEADER FILE

Defined in SDL3/SDL\_gamepad.h

## SYNOPSIS

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

**Sint16 SDL\_GetGamepadAxis(SDL\_Gamepad \*gamepad, SDL\_GamepadAxis axis);**

## DESCRIPTION

The axis indices start at index 0.

For thumbsticks, the state is a value ranging from -32768 (up/left) to 32767 (down/right).

Triggers range from 0 when released to 32767 when fully pressed, and never return a negative value. Note that this differs from the value reported by the lower-level  **SDL\_GetJoystickAxis** (), which normally uses the full range.

## FUNCTION PARAMETERS

- *gamepad*

  a gamepad.

- *axis*

  an axis index (one of the  **SDL\_GamepadAxis**\
    values).

## RETURN VALUE

( **Sint16** ) Returns axis state (including 0) on success or 0 (also) on failure; call  **SDL\_GetError** () for more information.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_GamepadHasAxis**(3)](/SDL_GamepadHasAxis/3.md), **•**(3), [**SDL\_GetGamepadButton**(3)](/SDL_GetGamepadButton/3.md)
