|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sdljava.joystick.SDLJoystick
public class SDLJoystick
Binding to the SDL Joystick routines.
Field Summary | |
---|---|
(package private) SWIGTYPE_p__SDL_Joystick |
swigJoystick
|
Constructor Summary | |
---|---|
private |
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 |
void |
joystickGetBall(int ball,
java.lang.Integer dx,
java.lang.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 java.lang.String |
joystickName(int index)
Get joystick name |
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 |
static void |
joystickUpdate()
Updates the state of all joysticks |
static int |
numJoysticks()
Count available joysticks. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
SWIGTYPE_p__SDL_Joystick swigJoystick
Constructor Detail |
---|
private SDLJoystick(SWIGTYPE_p__SDL_Joystick swigJoystick)
Method Detail |
---|
public static int numJoysticks()
Counts the number of joysticks attached to the system.
public static java.lang.String joystickName(int index)
Get the implementation dependent name of joystick. The index parameter refers to the N'th joystick on the system.
public static SDLJoystick joystickOpen(int index) throws SDLException
index
- index refers to the N'th joystick in the system
SDLException
- if an error occuredpublic static boolean joystickOpened(int index)
Determines whether a joystick has already been opened within the application.
index
- index refers to the N'th joystick on the system.
public static void joystickUpdate()
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.
public int joystickIndex()
public int joystickNumAxes()
public int joystickNumBalls()
public int joystickNumHats()
public int joystickNumButtons()
public int joystickGetAxis(int axis)
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.
axis
- an int
value
public HatState joystickGetHat(int hat)
hat
- The hat to get the state for
public boolean joystickGetButton(int button)
button
- an int
value
public void joystickGetBall(int ball, java.lang.Integer dx, java.lang.Integer dy) throws SDLException
ball
- The balldx
- The value of the x change will be placed heredy
- The value of the y change will be placed here
SDLException
- if an error occurspublic void joystickClose()
protected void finalize()
finalize
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |