docs/man3/SDL_JoystickGetAxis.3
author Sam Lantinga <slouken@lokigames.com>
Thu, 26 Apr 2001 16:45:43 +0000
changeset 0 74212992fb08
child 55 55f1f1b3e27d
permissions -rw-r--r--
Initial revision
slouken@0
     1
.TH "SDL_JoystickGetAxis" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" 
slouken@0
     2
.SH "NAME"
slouken@0
     3
SDL_JoystickGetAxis\- Get the current state of an axis
slouken@0
     4
.SH "SYNOPSIS"
slouken@0
     5
.PP
slouken@0
     6
\fB#include "SDL\&.h"
slouken@0
     7
.sp
slouken@0
     8
\fBSint16 \fBSDL_JoystickGetAxis\fP\fR(\fBSDL_Joystick *joystick, int axis\fR);
slouken@0
     9
.SH "DESCRIPTION"
slouken@0
    10
.PP
slouken@0
    11
\fBSDL_JoystickGetAxis\fP returns the current state of the given \fBaxis\fR on the given \fBjoystick\fR\&.
slouken@0
    12
.PP
slouken@0
    13
On most modern joysticks the X axis is usually represented by \fBaxis\fR 0 and the Y axis by \fBaxis\fR 1\&. The value returned by \fBSDL_JoystickGetAxis\fP is a signed integer (-32768 to 32768) representing the current position of the \fBaxis\fR, 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\&.
slouken@0
    14
.SH "RETURN VALUE"
slouken@0
    15
.PP
slouken@0
    16
Returns a 16-bit signed integer representing the current position of the \fBaxis\fR\&.
slouken@0
    17
.SH "EXAMPLES"
slouken@0
    18
.PP
slouken@0
    19
.PP
slouken@0
    20
.nf
slouken@0
    21
\f(CWSint16 x_move, y_move;
slouken@0
    22
SDL_Joystick *joy1;
slouken@0
    23
\&.
slouken@0
    24
\&.
slouken@0
    25
x_move=SDL_JoystickGetAxis(joy1, 0);
slouken@0
    26
y_move=SDL_JoystickGetAxis(joy1, 1);\fR
slouken@0
    27
.fi
slouken@0
    28
.PP
slouken@0
    29
.SH "SEE ALSO"
slouken@0
    30
.PP
slouken@0
    31
\fI\fBSDL_JoystickNumAxes\fP\fR
slouken@0
    32
...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03