sdljava.joystick
public class SDLJoystick extends Object
Version: $Id: SDLJoystick.java,v 1.3 2005/01/19 03:09:12 ivan_ganza Exp $
Field Summary | |
---|---|
SWIGTYPE_p__SDL_Joystick | swigJoystick |
Constructor Summary | |
---|---|
SDLJoystick(SWIGTYPE_p__SDL_Joystick swigJoystick) |
Method Summary | |
---|---|
protected void | finalize() |
void | joystickClose()
Closes a previously opened joystick
|
int | joystickGetAxis(int axis)
Get the current state of an axis
SDL_JoystickGetAxis returns the current state of the given axis on the given joystick. |
void | joystickGetBall(int ball, Integer dx, Integer dy)
Get relative trackball motion
|
boolean | joystickGetButton(int button)
Get the current state of a given button on a given joystick
|
HatState | joystickGetHat(int hat)
Get the current state of a joystick hat
|
int | joystickIndex()
Get the index of an SDL_Joystick.
|
static String | joystickName(int index)
Get joystick name
Get the implementation dependent name of joystick. |
int | joystickNumAxes()
Get the number of joystick axes
|
int | joystickNumBalls()
Get the number of joystick trackballs
|
int | joystickNumButtons()
Get the number of joystick Buttons
|
int | joystickNumHats()
Get the number of joystick hats
|
static SDLJoystick | joystickOpen(int index)
Opens a joystick for use. |
static boolean | joystickOpened(int index)
Determine if a joystick has been opened
Determines whether a joystick has already been opened within the application. |
static void | joystickUpdate()
Updates the state of all joysticks Updates the state(position, buttons, etc.) of all open joysticks. |
static int | numJoysticks()
Count available joysticks.
|
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. It is worth noting that some joysticks use axes 2 and 3 for extra buttons.
Parameters: axis an int
value
Returns: the current position of the axis.
Parameters: ball The ball dx The value of the x change will be placed here dy The value of the y change will be placed here
Throws: SDLException if an error occurs
Parameters: button an int
value
Returns: if the given button on the given joystick is pressed
Parameters: hat The hat to get the state for
Returns: the current state of the given hat on the given joystick.
Returns: Index number of the joystick.
Get the implementation dependent name of joystick. The index parameter refers to the N'th joystick on the system.
Returns: The joystick name
Returns: The number of axes
Returns: The number of trackballs
Returns: The number of Buttons
Returns: The number of hats
Parameters: index index refers to the N'th joystick in the system
Returns: The joystick
Throws: SDLException if an error occured
Determines whether a joystick has already been opened within the application.
Parameters: index index refers to the N'th joystick on the system.
Returns: if the joystick at index has been opened
Updates the state(position, buttons, etc.) of all open joysticks. If joystick events have been enabled with SDL_JoystickEventState then this is called automatically in the event loop.
Counts the number of joysticks attached to the system.
Returns: Returns the number of attached joysticks