DOKK / manpages / debian 13 / libsdl3-doc / SDL_GetGamepadAxis.3.en
SDL_GetGamepadAxis(3) SDL3 FUNCTIONS SDL_GetGamepadAxis(3)

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

Defined in SDL3/SDL_gamepad.h

#include "SDL3/SDL.h"
Sint16 SDL_GetGamepadAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis);

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.

a gamepad.
an axis index (one of the SDL_GamepadAxis
values).

( Sint16 ) Returns axis state (including 0) on success or 0 (also) on failure; call SDL_GetError () for more information.

This function is available since SDL 3.2.0.

(3), SDL_GamepadHasAxis(3), (3), SDL_GetGamepadButton(3)

SDL 3.2.10 Simple Directmedia Layer