carta
SDL_JoystickGetAxis(3)

SDL_JoystickGetAxis3

Get the current state of an axis

Usage

Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);

Overview

SDL_JoystickGetAxis returns the current state of the given axis on the given joystick.

On most modern joysticks the X axis is usually represented by axis 0 and the Y axis by axis 1. The value returned by SDL_JoystickGetAxis is a signed integer (-32768 to 32768) representing the current position of the axis, it maybe necessary to impose certain tolerances on these values to account for jitter. It is worth noting that some joysticks use axes 2 and 3 for extra buttons.

Return value

Returns a 16-bit signed integer representing the current position of the axis.

Examples

Sint16 x_move, y_move;
SDL_Joystick *joy1;
.
.
x_move=SDL_JoystickGetAxis(joy1, 0);
y_move=SDL_JoystickGetAxis(joy1, 1);

History

  • Debian 12 (Bookworm) to Debian 6.0 (Squeeze): the text shown here
  • Debian 5.0 (Lenny) to Debian 3.0 (Woody)

From libsdl1.2-dev 1.2.15+dfsg2-8 in Debian 12 (Bookworm). Parsed by carta from the page's man source.