1SDL_JoystickGetAxis(3) SDL API Reference SDL_JoystickGetAxis(3)
2
3
4
6 SDL_JoystickGetAxis - Get the current state of an axis
7
9 #include "SDL.h"
10
11 Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);
12
14 SDL_JoystickGetAxis returns the current state of the given axis on the
15 given joystick.
16
17 On most modern joysticks the X axis is usually represented by axis 0
18 and the Y axis by axis 1. The value returned by SDL_JoystickGetAxis is
19 a signed integer (-32768 to 32768) representing the current position of
20 the axis, it maybe necessary to impose certain tolerances on these val‐
21 ues to account for jitter. It is worth noting that some joysticks use
22 axes 2 and 3 for extra buttons.
23
25 Returns a 16-bit signed integer representing the current position of
26 the axis.
27
29 Sint16 x_move, y_move;
30 SDL_Joystick *joy1;
31 .
32 .
33 x_move=SDL_JoystickGetAxis(joy1, 0);
34 y_move=SDL_JoystickGetAxis(joy1, 1);
35
37 SDL_JoystickNumAxes
38
39
40
41SDL Tue 11 Sep 2001, 23:00 SDL_JoystickGetAxis(3)