|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.centralnexus.input.Joystick
Device driver to a Windows joystick. This handles at least an x,y motion joystick. A joystick can be plugged in as any id, and the first joystick id may or may not be plugged in. In order to create a Joystick, you must use one of createInstance functions.
There are two ways to update the axis and button values. You can either:
JoystickListener
Field Summary | |
static int |
BUTTON1
These are the standard buttons. |
static int |
BUTTON10
|
static int |
BUTTON11
|
static int |
BUTTON12
|
static int |
BUTTON13
|
static int |
BUTTON14
|
static int |
BUTTON15
|
static int |
BUTTON16
|
static int |
BUTTON17
|
static int |
BUTTON18
|
static int |
BUTTON19
|
static int |
BUTTON2
|
static int |
BUTTON20
|
static int |
BUTTON21
|
static int |
BUTTON22
|
static int |
BUTTON23
|
static int |
BUTTON24
|
static int |
BUTTON25
|
static int |
BUTTON26
|
static int |
BUTTON27
|
static int |
BUTTON28
|
static int |
BUTTON29
|
static int |
BUTTON3
|
static int |
BUTTON30
|
static int |
BUTTON31
|
static int |
BUTTON32
|
static int |
BUTTON4
|
static int |
BUTTON5
These are the extended buttons |
static int |
BUTTON6
|
static int |
BUTTON7
|
static int |
BUTTON8
|
static int |
BUTTON9
|
static int |
HAS_POV
Does this joystick have a point-of-view control capability? |
static int |
HAS_POV4DIR
Does this joystick point-of-view support discrete values capability (centered, forward, backward, left, and right)? |
static int |
HAS_POVCONT
Does this joystick point-of-view support continuous degree bearings capability? |
static int |
HAS_R
Does this joystick have a r-axis capability? |
static int |
HAS_U
Does this joystick have a u-axis capability? |
static int |
HAS_V
Does this joystick have a v-axis capability? |
static int |
HAS_Z
Does this joystick have a z-axis capability? |
static float |
POV_BACKWARD
Point-of-view hat is pressed backward. |
static float |
POV_CENTERED
Point-of-view hat is in the neutral position. |
static float |
POV_FORWARD
Point-of-view hat is pressed forward. |
static float |
POV_LEFT
Point-of-view hat is being pressed to the left. |
static float |
POV_RIGHT
Point-of-view hat is pressed to the right. |
Method Summary | |
void |
addJoystickListener(JoystickListener l)
Adds the specified joystick listener to receive joystick events from this joystick. |
static Joystick |
createInstance()
Start using the first available joystick. |
static Joystick |
createInstance(int id)
Start using a joystick with a specific id. |
int |
getButtons()
Current state of joystick buttons. |
int |
getCapabilities()
Get the Capability bits. |
boolean |
getCapability(int capability)
Is a certain capability bit turned on? |
float |
getDeadZone()
Size of the dead zone. |
int |
getID()
The joystick id for the joystick connected to the computer. |
int |
getNumAxes()
Number of axes currently in use by the joystick. |
int |
getNumButtons()
Number of buttons on the joystick. |
static int |
getNumDevices()
Returns the number of joysticks supported by the joystick driver or zero when no driver is present. |
int |
getPollInterval()
Get the time in milliseconds that the JoystickListeners get notified of this joystick events. |
float |
getPOV()
Current position of the point-of-view control. |
float |
getR()
The r value of a joystick has a range from -1 to 1. |
float |
getU()
The u value of a joystick has a range from -1 to 1. |
float |
getV()
The v value of a joystick has a range from -1 to 1. |
float |
getX()
The x value of a joystick has a range from -1 to 1. |
float |
getY()
The y value of a joystick has a range from -1 to 1. |
float |
getZ()
The z value of a joystick has a range from -1 to 1. |
boolean |
isButtonDown(int button)
Current state of a specific joystick button. |
static boolean |
isPluggedIn(int id)
Returns true when the joystick is plugged into the computer, false otherwise. |
void |
poll()
This polls (updates) the joystick for its values. |
void |
removeJoystickListener(JoystickListener l)
Removes the specified joystick listener so that it no longer receives joystick events from this joystick. |
void |
setDeadZone(double deadZoneVal)
Synonym for setDeadZone(float) |
void |
setDeadZone(float deadZoneVal)
Size of the dead zone. |
void |
setPollInterval(int pollMillis)
Set the time in milliseconds that the JoystickListeners get notified of this joystick events. |
java.lang.String |
toString()
Text description of this joystick without the axis values |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int HAS_Z
public static final int HAS_R
public static final int HAS_U
public static final int HAS_V
public static final int HAS_POV
public static final int HAS_POV4DIR
public static final int HAS_POVCONT
public static final float POV_CENTERED
public static final float POV_FORWARD
public static final float POV_RIGHT
public static final float POV_BACKWARD
public static final float POV_LEFT
public static final int BUTTON1
public static final int BUTTON2
public static final int BUTTON3
public static final int BUTTON4
public static final int BUTTON5
public static final int BUTTON6
public static final int BUTTON7
public static final int BUTTON8
public static final int BUTTON9
public static final int BUTTON10
public static final int BUTTON11
public static final int BUTTON12
public static final int BUTTON13
public static final int BUTTON14
public static final int BUTTON15
public static final int BUTTON16
public static final int BUTTON17
public static final int BUTTON18
public static final int BUTTON19
public static final int BUTTON20
public static final int BUTTON21
public static final int BUTTON22
public static final int BUTTON23
public static final int BUTTON24
public static final int BUTTON25
public static final int BUTTON26
public static final int BUTTON27
public static final int BUTTON28
public static final int BUTTON29
public static final int BUTTON30
public static final int BUTTON31
public static final int BUTTON32
Method Detail |
public static final int getNumDevices()
public static boolean isPluggedIn(int id)
id
- The ID of the joystick where 0 <= id < getNumDevs().public static Joystick createInstance() throws java.io.IOException
java.io.IOException
- Thrown when a joystick
is not plugged into the computer.public static Joystick createInstance(int id) throws java.io.IOException
id
- The joystick id to get joystick information from.
java.io.IOException
- Thrown when the joystick for the id
is not plugged into the computer.public final int getID()
getNumDevices()
public void poll()
public int getCapabilities()
getCapability(int)
public final boolean getCapability(int capability)
HAS_Z
,
HAS_R
,
HAS_U
,
HAS_V
,
HAS_POV
,
HAS_POV4DIR
,
HAS_POVCONT
public float getX()
public float getY()
public float getZ()
getCapabilities()
public float getR()
getCapabilities()
public float getU()
getCapabilities()
public float getV()
getCapabilities()
public float getPOV()
getCapabilities()
public int getButtons()
BUTTON1
,
BUTTON2
,
BUTTON3
,
BUTTON4
public boolean isButtonDown(int button)
button
- can be BUTTON1, BUTTON2, BUTTON3 and so on.
BUTTON1
,
BUTTON2
,
BUTTON3
,
BUTTON4
public int getNumButtons()
public int getNumAxes()
public final float getDeadZone()
public final void setDeadZone(float deadZoneVal)
java.lang.IllegalArgumentException
- when deadZone is out of the range
0 <= deadZone <= 1.0.public final void setDeadZone(double deadZoneVal)
public void addJoystickListener(JoystickListener l)
l
- The joystick listenerpublic void removeJoystickListener(JoystickListener l)
l
- The joystick listenerpublic void setPollInterval(int pollMillis)
public int getPollInterval()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |