state = sdl.GetAxis(port, axis)
axis
must be the number of the axis to
query. 0 is typically used for the x-axis and 1 for the y-axis. Some joysticks use axes
2 or 3 for extra buttons. You can use sdl.GetNumAxes() to find out the number of
axes.
If the device at the specified port is a game controller, axis
must be one of
the following predefined constants:
#SDL_AXIS_LEFTX #SDL_AXIS_LEFTY #SDL_AXIS_RIGHTX #SDL_AXIS_RIGHTY #SDL_AXIS_TRIGGERLEFT #SDL_AXIS_TRIGGERRIGHT |
The return value is a value ranging from -32768 to 32767. It may be necessary to impose certain tolerances on these values to account for jitter. Note that game controller triggers, however, range from 0 to 32767. They never return a negative value.