Wiki Page Content

Differences between revisions 6 and 7
Revision 6 as of 2013-09-01 18:35:45
Size: 1597
Comment: Updated usage of Color2 macro.
Revision 7 as of 2014-01-11 19:28:22
Size: 1563
Comment: Removed *, BR and old formatting.
Deletions are marked like this. Additions are marked like this.
Line 18: Line 18:
||'''axis'''||^the axis to query^; the axis indices start at index 0; see [[#Remarks|Remarks]] for details|| ||'''axis'''||the axis to query; the axis indices start at index 0; see [[#Remarks|Remarks]] for details||
Line 21: Line 21:
*<<BR>>Returns a 16-bit signed integer representing the current position of the axis ^or 0 on failure; call [[SDL_GetError]]() for more information^.<<BR>>* Returns a 16-bit signed integer representing the current position of the axis or 0 on failure; call [[SDL_GetError]]() for more information.
Line 35: Line 35:
*<<BR>>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. 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.
Line 37: Line 37:
Some joysticks use axes 2 and 3 for extra buttons.<<BR>>* Some joysticks use axes 2 and 3 for extra buttons.
Line 40: Line 40:
 .[[SDL_JoystickNumAxes]] *  .[[SDL_JoystickNumAxes]]

DRAFT

SDL_JoystickGetAxis

Use this function to get the current state of an axis control on a joystick.

Syntax

Sint16 SDL_JoystickGetAxis(SDL_Joystick* joystick,
                           int           axis)

Function Parameters

joystick

an SDL_Joystick structure containing joystick information ???

axis

the axis to query; the axis indices start at index 0; see Remarks for details

Return Value

Returns a 16-bit signed integer representing the current position of the axis or 0 on failure; call SDL_GetError() for more information.

The state is a value ranging from -32768 to 32767. Is this the RV or a Remark?

Code Examples

extern SDL_Joystick* joy1;
Sint16 x_move, y_move;

x_move = SDL_JoystickGetAxis(joy1, 0);
y_move = SDL_JoystickGetAxis(joy1, 1);

Remarks

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.

Some joysticks use axes 2 and 3 for extra buttons.


CategoryAPI, CategoryJoystick

None: SDL_JoystickGetAxis (last edited 2015-05-31 19:40:35 by PhilippWiesemann)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit