SDL_JoystickGetAxis

Name

SDL_JoystickGetAxis -- Get the current state of an axis

Synopsis

#include "SDL.h"

Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);

Description

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 32767) representing the current position of the axis, it may be necessary to impose certain tolerances on these values to account for jitter.

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);

See Also

SDL_JoystickNumAxes

SDL_JoystickGetAxis (last edited 2008-04-17 08:18:32 by localhost)