###### (This is the documentation for SDL3, which is the current stable version. [SDL2](https://wiki.libsdl.org/SDL2/) was the previous version!) # SDL_GetGamepadAxis Get the current state of an axis control on a gamepad. ## Header File Defined in [](https://github.com/libsdl-org/SDL/blob/main/include/SDL3/SDL_gamepad.h) ## Syntax ```c Sint16 SDL_GetGamepadAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis); ``` ## Function Parameters | | | | | ---------------------------------- | ----------- | --------------------------------------------------------------------- | | [SDL_Gamepad](SDL_Gamepad) * | **gamepad** | a gamepad. | | [SDL_GamepadAxis](SDL_GamepadAxis) | **axis** | an axis index (one of the [SDL_GamepadAxis](SDL_GamepadAxis) values). | ## Return Value ([Sint16](Sint16)) Returns axis state (including 0) on success or 0 (also) on failure; call [SDL_GetError](SDL_GetError)() for more information. ## Remarks 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](SDL_GetJoystickAxis)(), which normally uses the full range. ## Version This function is available since SDL 3.1.3. ## See Also - [SDL_GamepadHasAxis](SDL_GamepadHasAxis) - [SDL_GetGamepadButton](SDL_GetGamepadButton) ---- [CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction), [CategoryGamepad](CategoryGamepad)