at.wisch.joystick
Class AbstractController

java.lang.Object
  extended by at.wisch.joystick.AbstractController
All Implemented Interfaces:
AdvancedController, Controller
Direct Known Subclasses:
Joystick

public abstract class AbstractController
extends java.lang.Object
implements AdvancedController

The abstract class AbstractController. It implements some of the interface AdvancedController's methods, that just exist for convenience. E.g. getXAxisValue() is "redirected" to getAxisValue(0). It also defines some constants for the classes Joystick and FFJoystick.

Joystick extends this abstract class, hence it also implements AdvancedController. FFJoystick extends Joystick and implements the interface AdvancedFFController (which is an extension of AdvancedController).

Author:
Martin Wischenbart

Field Summary
static float AXIS_DEFAULT_DEAD_ZONE
          The constant AXIS_DEFAULT_DEAD_ZONE (0.03f): Default dead zone for analogue axes.
static float AXIS_MAXIMUM
          The constant AXIS_MAXIMUM (1.0f ): Analogue axis position on maximum (i.e. to the positive side).
static float AXIS_MINIMUM
          The constant AXIS_MINIMUM (-1.0f ): Analogue axis position on minimum (i.e. to the negative side).
static float AXIS_NEUTRAL
          The constant AXIS_NEUTRAL (0.0f ): Analogue axis is in central position.
static int DEFAULT_AUTOCENTER_VALUE
          The constant DEFAULT_AUTOCENTER_VALUE (0 ): Default autocenter value for FF joysticks.
static int DEFAULT_GAIN_VALUE
          The constant DEFAULT_GAIN_VALUE (100 ): Default gain value for FF joysticks.
static int INFINITE_TIMES
          The constant INFINITE_TIMES: Play an FF effect infinite times.
static int POV_AXIS_NEGATIVE
          The constant POV_AXIS_NEGATIVE (-1 ): POV axis is on the negative side.
static int POV_AXIS_NEUTRAL
          The constant POV_AXIS_NEUTRAL (0 ): POV axis is in neutral position (center).
static int POV_AXIS_POSITIVE
          The constant POV_AXIS_POSITIVE (1 ): POV axis is on the positive side.
static int POV_CENTERED
          The constant POV_CENTERED (-1 ): POV is in center position.
static int POV_DOWN
          The constant POV_DOWN (18000 ): POV position is down.
static int POV_DOWN_LEFT
          The constant POV_DOWN_LEFT (22500 ): POV position is down-left.
static int POV_DOWN_RIGHT
          The constant POV_DOWN_RIGHT (13500 ): POV position is down-right.
static int POV_LEFT
          The constant POV_LEFT (27000 ): POV position is left.
static int POV_RIGHT
          The constant POV_RIGHT (9000 ): POV position is right.
static int POV_UP
          The constant POV_UP (0 ): POV position is up.
static int POV_UP_LEFT
          The constant POV_UP_LEFT (31500 ): POV position is up-left.
static int POV_UP_RIGHT
          The constant POV_UP_RIGHT (4500 ): POV position is up-right.
 
Method Summary
 java.lang.String getAxisName(int axisIndex)
          Get the name that's given to the specified axis
 int[] getBall1Delta()
          Gets the delta for the first trackball (ballIndex 0)
 int[] getBall2Delta()
          Gets the delta for the second trackball (ballIndex 1)
 int[] getBall3Delta()
          Gets the delta for the third trackball (ballIndex 2)
 int[] getBall4Delta()
          Gets the delta for the fourth trackball (ballIndex 3)
 java.lang.String getBallName(int ballIndex)
          Gets the trackball's name.
 java.lang.String getButtonName(int buttonIndex)
          Get the name of the specified button.
 int getPov1X()
          Gets the first POV's X coordinate value.
 int getPov1Y()
          Gets the first POV's Y coordinate value.
 int getPov2X()
          Gets the second POV's X coordinate value.
 int getPov2Y()
          Gets the second POV's Y coordinate value.
 int getPov3X()
          Gets the third POV's X coordinate value.
 int getPov3Y()
          Gets the third POV's Y coordinate value.
 int getPov4X()
          Gets the fourth POV's X coordinate value.
 int getPov4Y()
          Gets the fourth POV's Y coordinate value.
 java.lang.String getPovName(int povIndex)
          Gets the POV's name.
 float getPovX()
          Deprecated. uses float where int would be sufficient. Use getPovValueX(0) instead.
 float getPovY()
          Deprecated. uses float where int would be sufficient. Use getPovValueY(0) instead.
 float getRXAxisDeadZone()
          Get the dead zone for the RX axis.
 float getRXAxisValue()
          Get the value from the RX axis if there is one.
 float getRYAxisDeadZone()
          Get the dead zone for the RY axis.
 float getRYAxisValue()
          Get the value from the RY axis if there is one.
 float getRZAxisDeadZone()
          Get the dead zone for the RZ axis.
 float getRZAxisValue()
          Get the value from the RZ axis if there is one.
 float getUAxisDeadZone()
          Get the dead zone for the U axis.
 float getUAxisValue()
          Get the value from the U axis if there is one.
 float getVAxisDeadZone()
          Get the dead zone for the V axis.
 float getVAxisValue()
          Get the value from the V axis if there is one.
 float getXAxisDeadZone()
          Get the dead zone for the X axis.
 float getXAxisValue()
          Get the value from the X axis if there is one.
 float getYAxisDeadZone()
          Get the dead zone for the Y axis.
 float getYAxisValue()
          Get the value from the Y axis if there is one.
 float getZAxisDeadZone()
          Get the dead zone for the Z axis.
 float getZAxisValue()
          Get the value from the Z axis if there is one.
 void setRXAxisDeadZone(float zone)
          Set the dead zone for the RX axis.
 void setRYAxisDeadZone(float zone)
          Set the dead zone for the RY axis.
 void setRZAxisDeadZone(float zone)
          Set the dead zone for the RZ axis.
 void setUAxisDeadZone(float zone)
          Set the dead zone for the U axis.
 void setVAxisDeadZone(float zone)
          Set the dead zone for the V axis.
 void setXAxisDeadZone(float zone)
          Set the dead zone for the X axis.
 void setYAxisDeadZone(float zone)
          Set the dead zone for the Y axis.
 void setZAxisDeadZone(float zone)
          Set the dead zone for the Z axis.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface at.wisch.joystick.AdvancedController
getBallCount, getBallDelta, getPovCount, getPovDirection, getPovX, getPovY, isFFJoystick
 
Methods inherited from interface org.lwjgl.input.Controller
getAxisCount, getAxisValue, getButtonCount, getDeadZone, getIndex, getName, isButtonPressed, poll, setDeadZone
 

Field Detail

POV_CENTERED

public static final int POV_CENTERED
The constant POV_CENTERED (-1 ): POV is in center position.

See Also:
Constant Field Values

POV_UP

public static final int POV_UP
The constant POV_UP (0 ): POV position is up.

See Also:
Constant Field Values

POV_UP_RIGHT

public static final int POV_UP_RIGHT
The constant POV_UP_RIGHT (4500 ): POV position is up-right.

See Also:
Constant Field Values

POV_RIGHT

public static final int POV_RIGHT
The constant POV_RIGHT (9000 ): POV position is right.

See Also:
Constant Field Values

POV_DOWN_RIGHT

public static final int POV_DOWN_RIGHT
The constant POV_DOWN_RIGHT (13500 ): POV position is down-right.

See Also:
Constant Field Values

POV_DOWN

public static final int POV_DOWN
The constant POV_DOWN (18000 ): POV position is down.

See Also:
Constant Field Values

POV_DOWN_LEFT

public static final int POV_DOWN_LEFT
The constant POV_DOWN_LEFT (22500 ): POV position is down-left.

See Also:
Constant Field Values

POV_LEFT

public static final int POV_LEFT
The constant POV_LEFT (27000 ): POV position is left.

See Also:
Constant Field Values

POV_UP_LEFT

public static final int POV_UP_LEFT
The constant POV_UP_LEFT (31500 ): POV position is up-left.

See Also:
Constant Field Values

POV_AXIS_NEUTRAL

public static final int POV_AXIS_NEUTRAL
The constant POV_AXIS_NEUTRAL (0 ): POV axis is in neutral position (center).

See Also:
Constant Field Values

POV_AXIS_POSITIVE

public static final int POV_AXIS_POSITIVE
The constant POV_AXIS_POSITIVE (1 ): POV axis is on the positive side.

See Also:
Constant Field Values

POV_AXIS_NEGATIVE

public static final int POV_AXIS_NEGATIVE
The constant POV_AXIS_NEGATIVE (-1 ): POV axis is on the negative side.

See Also:
Constant Field Values

AXIS_NEUTRAL

public static final float AXIS_NEUTRAL
The constant AXIS_NEUTRAL (0.0f ): Analogue axis is in central position.

See Also:
Constant Field Values

AXIS_MAXIMUM

public static final float AXIS_MAXIMUM
The constant AXIS_MAXIMUM (1.0f ): Analogue axis position on maximum (i.e. to the positive side).

See Also:
Constant Field Values

AXIS_MINIMUM

public static final float AXIS_MINIMUM
The constant AXIS_MINIMUM (-1.0f ): Analogue axis position on minimum (i.e. to the negative side).

See Also:
Constant Field Values

AXIS_DEFAULT_DEAD_ZONE

public static final float AXIS_DEFAULT_DEAD_ZONE
The constant AXIS_DEFAULT_DEAD_ZONE (0.03f): Default dead zone for analogue axes.

See Also:
Constant Field Values

INFINITE_TIMES

public static final int INFINITE_TIMES
The constant INFINITE_TIMES: Play an FF effect infinite times.

See Also:
Constant Field Values

DEFAULT_GAIN_VALUE

public static final int DEFAULT_GAIN_VALUE
The constant DEFAULT_GAIN_VALUE (100 ): Default gain value for FF joysticks.

See Also:
Constant Field Values

DEFAULT_AUTOCENTER_VALUE

public static final int DEFAULT_AUTOCENTER_VALUE
The constant DEFAULT_AUTOCENTER_VALUE (0 ): Default autocenter value for FF joysticks.

See Also:
Constant Field Values
Method Detail

getButtonName

public java.lang.String getButtonName(int buttonIndex)
Get the name of the specified button.

Specified by:
getButtonName in interface Controller
Parameters:
buttonIndex - the index of the button whose name should be retrieved (button indices start at 0)
Returns:
the name of the button requested (typically buttonIndex+1)
See Also:
Controller.getButtonCount()

getPovName

public final java.lang.String getPovName(int povIndex)
Gets the POV's name.

Specified by:
getPovName in interface AdvancedController
Parameters:
povIndex - the POV index (POV indices start from 0)
Returns:
the POV's name (which is just povIndex+1)
See Also:
AdvancedController.getPovCount()

getPov1X

public final int getPov1X()
Gets the first POV's X coordinate value.

Specified by:
getPov1X in interface AdvancedController
Returns:
getPovValueX(0)
See Also:
AdvancedController.getPovX(int)

getPov1Y

public final int getPov1Y()
Gets the first POV's Y coordinate value.

Specified by:
getPov1Y in interface AdvancedController
Returns:
getPovValueY(0)
See Also:
AdvancedController.getPovY(int)

getPov2X

public final int getPov2X()
Gets the second POV's X coordinate value.

Specified by:
getPov2X in interface AdvancedController
Returns:
getPovValueX(1)
See Also:
AdvancedController.getPovX(int)

getPov2Y

public final int getPov2Y()
Gets the second POV's Y coordinate value.

Specified by:
getPov2Y in interface AdvancedController
Returns:
getPovValueY(1)
See Also:
AdvancedController.getPovY(int)

getPov3X

public final int getPov3X()
Gets the third POV's X coordinate value.

Specified by:
getPov3X in interface AdvancedController
Returns:
getPovValueX(2)
See Also:
AdvancedController.getPovX(int)

getPov3Y

public final int getPov3Y()
Gets the third POV's Y coordinate value.

Specified by:
getPov3Y in interface AdvancedController
Returns:
getPovValueY(2)
See Also:
AdvancedController.getPovY(int)

getPov4X

public final int getPov4X()
Gets the fourth POV's X coordinate value.

Specified by:
getPov4X in interface AdvancedController
Returns:
getPovValueX(3)
See Also:
AdvancedController.getPovX(int)

getPov4Y

public final int getPov4Y()
Gets the fourth POV's Y coordinate value.

Specified by:
getPov4Y in interface AdvancedController
Returns:
getPovValueY(3) *
See Also:
AdvancedController.getPovY(int)

getPovX

@Deprecated
public final float getPovX()
Deprecated. uses float where int would be sufficient. Use getPovValueX(0) instead.

Gets the X-Axis value of the first POV on this controller as a float.

Specified by:
getPovX in interface Controller
Returns:
the X-Axis value of the first POV on this controller as float
See Also:
AdvancedController.getPovDirection(int)

getPovY

@Deprecated
public final float getPovY()
Deprecated. uses float where int would be sufficient. Use getPovValueY(0) instead.

Gets the Y-Axis value of the first POV on this controller as a float.

Specified by:
getPovY in interface Controller
Returns:
the Y-Axis value of the first POV on this controller as float
See Also:
AdvancedController.getPovDirection(int)

getAxisName

public final java.lang.String getAxisName(int axisIndex)
Get the name that's given to the specified axis

Specified by:
getAxisName in interface Controller
Parameters:
axisIndex - The index of the axis whose name should be retrieved (axis indices start with 0)
Returns:
the name of the specified axis: for the first axes that is "X", "Y", "Z", "rX", "rY", "rZ", "U", "V", beyond that it's axisIndex+1
See Also:
Controller.getAxisCount()

getXAxisValue

public final float getXAxisValue()
Get the value from the X axis if there is one. If no X axis is defined AXIS_NEUTRAL will be returned.

Specified by:
getXAxisValue in interface Controller
Returns:
the value from the X axis: AXIS_NEUTRAL, AXIS_MINIMUM, AXIS_MAXIMUM or anything between AXIS_MINIMUM and AXIS_MAXIMUM (anything from -1f to 1f)
See Also:
Controller.getAxisValue(int)

getYAxisValue

public final float getYAxisValue()
Get the value from the Y axis if there is one. If no Y axis is defined AXIS_NEUTRAL will be returned.

Specified by:
getYAxisValue in interface Controller
Returns:
the value from the Y axis: AXIS_NEUTRAL, AXIS_MINIMUM, AXIS_MAXIMUM or anything between AXIS_MINIMUM and AXIS_MAXIMUM (anything from -1f to 1f)
See Also:
Controller.getAxisValue(int)

getZAxisValue

public final float getZAxisValue()
Get the value from the Z axis if there is one. If no Z axis is defined AXIS_NEUTRAL will be returned.

Specified by:
getZAxisValue in interface Controller
Returns:
the value from the Z axis: AXIS_NEUTRAL, AXIS_MINIMUM, AXIS_MAXIMUM or anything between AXIS_MINIMUM and AXIS_MAXIMUM (anything from -1f to 1f)
See Also:
Controller.getAxisValue(int)

getRXAxisValue

public final float getRXAxisValue()
Get the value from the RX axis if there is one. If no RX axis is defined AXIS_NEUTRAL will be returned.

Specified by:
getRXAxisValue in interface Controller
Returns:
the value from the RX axis: AXIS_NEUTRAL, AXIS_MINIMUM, AXIS_MAXIMUM or anything between AXIS_MINIMUM and AXIS_MAXIMUM (anything from -1f to 1f)
See Also:
Controller.getAxisValue(int)

getRYAxisValue

public final float getRYAxisValue()
Get the value from the RY axis if there is one. If no RY axis is defined AXIS_NEUTRAL will be returned.

Specified by:
getRYAxisValue in interface Controller
Returns:
the value from the RY axis: AXIS_NEUTRAL, AXIS_MINIMUM, AXIS_MAXIMUM or anything between AXIS_MINIMUM and AXIS_MAXIMUM (anything from -1f to 1f)
See Also:
Controller.getAxisValue(int)

getRZAxisValue

public final float getRZAxisValue()
Get the value from the RZ axis if there is one. If no RZ axis is defined AXIS_NEUTRAL will be returned.

Specified by:
getRZAxisValue in interface Controller
Returns:
the value from the RZ axis: AXIS_NEUTRAL, AXIS_MINIMUM, AXIS_MAXIMUM or anything between AXIS_MINIMUM and AXIS_MAXIMUM (anything from -1f to 1f)
See Also:
Controller.getAxisValue(int)

getUAxisValue

public final float getUAxisValue()
Get the value from the U axis if there is one. If the axis does not exist AXIS_NEUTRAL will be returned.

Specified by:
getUAxisValue in interface AdvancedController
Returns:
the U axis value: AXIS_NEUTRAL, AXIS_MINIMUM, AXIS_MAXIMUM or anything between AXIS_MINIMUM and AXIS_MAXIMUM
See Also:
Controller.getAxisValue(int)

getVAxisValue

public final float getVAxisValue()
Get the value from the V axis if there is one. If the axis does not exist AXIS_NEUTRAL will be returned.

Specified by:
getVAxisValue in interface AdvancedController
Returns:
the V axis value: AXIS_NEUTRAL, AXIS_MINIMUM, AXIS_MAXIMUM or anything between AXIS_MINIMUM and AXIS_MAXIMUM
See Also:
Controller.getAxisValue(int)

getXAxisDeadZone

public final float getXAxisDeadZone()
Get the dead zone for the X axis.

Specified by:
getXAxisDeadZone in interface Controller
Returns:
the dead zone for the X axis
See Also:
Controller.setXAxisDeadZone(float), Controller.getDeadZone(int)

getYAxisDeadZone

public final float getYAxisDeadZone()
Get the dead zone for the Y axis.

Specified by:
getYAxisDeadZone in interface Controller
Returns:
the dead zone for the Y axis
See Also:
Controller.setYAxisDeadZone(float), Controller.getDeadZone(int)

getZAxisDeadZone

public final float getZAxisDeadZone()
Get the dead zone for the Z axis.

Specified by:
getZAxisDeadZone in interface Controller
Returns:
the dead zone for the Z axis
See Also:
Controller.setZAxisDeadZone(float), Controller.getDeadZone(int)

getRXAxisDeadZone

public final float getRXAxisDeadZone()
Get the dead zone for the RX axis.

Specified by:
getRXAxisDeadZone in interface Controller
Returns:
the dead zone for the RX axis
See Also:
Controller.setRXAxisDeadZone(float), Controller.getDeadZone(int)

getRYAxisDeadZone

public final float getRYAxisDeadZone()
Get the dead zone for the RY axis.

Specified by:
getRYAxisDeadZone in interface Controller
Returns:
the dead zone for the RY axis
See Also:
Controller.setRYAxisDeadZone(float), Controller.getDeadZone(int)

getRZAxisDeadZone

public final float getRZAxisDeadZone()
Get the dead zone for the RZ axis.

Specified by:
getRZAxisDeadZone in interface Controller
Returns:
the dead zone for the RZ axis
See Also:
Controller.setRZAxisDeadZone(float), Controller.getDeadZone(int)

getUAxisDeadZone

public final float getUAxisDeadZone()
Get the dead zone for the U axis.

Specified by:
getUAxisDeadZone in interface AdvancedController
Returns:
the dead zone for the U axis
See Also:
AdvancedController.setUAxisDeadZone(float), Controller.getDeadZone(int)

getVAxisDeadZone

public final float getVAxisDeadZone()
Get the dead zone for the V axis.

Specified by:
getVAxisDeadZone in interface AdvancedController
Returns:
the dead zone for the V axis
See Also:
AdvancedController.setVAxisDeadZone(float), Controller.getDeadZone(int)

setXAxisDeadZone

public final void setXAxisDeadZone(float zone)
Set the dead zone for the X axis. Typical values are between 0.01f and 0.2f.

Specified by:
setXAxisDeadZone in interface Controller
Parameters:
zone - the dead zone to use for the X axis: a value from 0f to AXIS_MAXIMUM (1f)
See Also:
Controller.getXAxisDeadZone(), Controller.setDeadZone(int, float)

setYAxisDeadZone

public final void setYAxisDeadZone(float zone)
Set the dead zone for the Y axis. Typical values are between 0.01f and 0.2f.

Specified by:
setYAxisDeadZone in interface Controller
Parameters:
zone - the dead zone to use for the Y axis: a value from 0f to AXIS_MAXIMUM (1f)
See Also:
Controller.getYAxisDeadZone(), Controller.setDeadZone(int, float)

setZAxisDeadZone

public final void setZAxisDeadZone(float zone)
Set the dead zone for the Z axis. Typical values are between 0.01f and 0.2f.

Specified by:
setZAxisDeadZone in interface Controller
Parameters:
zone - the dead zone to use for the Z axis: a value from 0f to AXIS_MAXIMUM (1f)
See Also:
Controller.getZAxisDeadZone(), Controller.setDeadZone(int, float)

setRXAxisDeadZone

public final void setRXAxisDeadZone(float zone)
Set the dead zone for the RX axis. Typical values are between 0.01f and 0.2f.

Specified by:
setRXAxisDeadZone in interface Controller
Parameters:
zone - the dead zone to use for the RX axis: a value from 0f to AXIS_MAXIMUM (1f)
See Also:
Controller.getRXAxisDeadZone(), Controller.setDeadZone(int, float)

setRYAxisDeadZone

public final void setRYAxisDeadZone(float zone)
Set the dead zone for the RY axis. Typical values are between 0.01f and 0.2f.

Specified by:
setRYAxisDeadZone in interface Controller
Parameters:
zone - the dead zone to use for the RY axis: a value from 0f to AXIS_MAXIMUM (1f)
See Also:
Controller.getRYAxisDeadZone(), Controller.setDeadZone(int, float)

setRZAxisDeadZone

public final void setRZAxisDeadZone(float zone)
Set the dead zone for the RZ axis. Typical values are between 0.01f and 0.2f.

Specified by:
setRZAxisDeadZone in interface Controller
Parameters:
zone - the dead zone to use for the RZ axis: a value from 0f to AXIS_MAXIMUM (1f)
See Also:
Controller.getRZAxisDeadZone(), Controller.setDeadZone(int, float)

setUAxisDeadZone

public final void setUAxisDeadZone(float zone)
Set the dead zone for the U axis. Typical values are between 0.01f and 0.2f.

Specified by:
setUAxisDeadZone in interface AdvancedController
Parameters:
zone - the dead zone to use for the U axis: a value from 0f to AXIS_MAXIMUM
See Also:
AdvancedController.getUAxisDeadZone(), Controller.setDeadZone(int, float)

setVAxisDeadZone

public final void setVAxisDeadZone(float zone)
Set the dead zone for the V axis. Typical values are between 0.01f and 0.2f.

Specified by:
setVAxisDeadZone in interface AdvancedController
Parameters:
zone - the dead zone to use for the V axis: a value from 0f to AXIS_MAXIMUM
See Also:
AdvancedController.getVAxisDeadZone(), Controller.setDeadZone(int, float)

getBallName

public final java.lang.String getBallName(int ballIndex)
Gets the trackball's name.

Specified by:
getBallName in interface AdvancedController
Parameters:
ballIndex - the trackball index (ball indices start from 0)
Returns:
the trackball's name (which is just ballIndex+1)
See Also:
AdvancedController.getBallCount()

getBall1Delta

public final int[] getBall1Delta()
Gets the delta for the first trackball (ballIndex 0)

Specified by:
getBall1Delta in interface AdvancedController
Returns:
delta for the first trackball
See Also:
AdvancedController.getBallDelta(int)

getBall2Delta

public final int[] getBall2Delta()
Gets the delta for the second trackball (ballIndex 1)

Specified by:
getBall2Delta in interface AdvancedController
Returns:
delta for the second trackball
See Also:
AdvancedController.getBallDelta(int)

getBall3Delta

public final int[] getBall3Delta()
Gets the delta for the third trackball (ballIndex 2)

Specified by:
getBall3Delta in interface AdvancedController
Returns:
delta for the third trackball
See Also:
AdvancedController.getBallDelta(int)

getBall4Delta

public final int[] getBall4Delta()
Gets the delta for the fourth trackball (ballIndex 3)

Specified by:
getBall4Delta in interface AdvancedController
Returns:
delta for the fourth trackball
See Also:
AdvancedController.getBallDelta(int)