org.lwjgl.input
Interface Controller

All Known Subinterfaces:
AdvancedController, AdvancedFFController
All Known Implementing Classes:
AbstractController, FFJoystick, Joystick

public interface Controller

A game controller of some sort that will provide input. The controller presents buttons and axes. Buttons are either pressed or not pressed. Axis provide analogue values.

Author:
Kevin Glass --- javadoc comments extended by Martin Wischenbart for http://sourceforge.net/projects/ffjoystick4java/

Method Summary
 int getAxisCount()
          Retrieve the number of axes available on this controller.
 java.lang.String getAxisName(int axisIndex)
          Get the name that's given to the specified axis
 float getAxisValue(int axisIndex)
          Retrieve the value thats currently available on a specified axis.
 int getButtonCount()
          Retrieve the number of buttons available on this controller.
 java.lang.String getButtonName(int buttonIndex)
          Get the name of the specified button.
 float getDeadZone(int axisIndex)
          Get the dead zone for a specified axis.
 int getIndex()
          Gets the index of this controller in the collection.
 java.lang.String getName()
          Gets the name assigned to this controller.
 float getPovX()
          Gets the X-Axis value of the first POV on this controller as a float.
 float getPovY()
          Gets the Y-Axis value of the first POV on this controller as a float.
 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 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.
 boolean isButtonPressed(int buttonIndex)
          Check if a button is currently pressed
 void poll()
          Poll the controller for new data.
 void setDeadZone(int axisIndex, float zone)
          Set the dead zone for the specified axis.
 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 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.
 

Method Detail

getName

java.lang.String getName()
Gets the name assigned to this controller.

Returns:
the name assigned to this controller

getIndex

int getIndex()
Gets the index of this controller in the collection.

Returns:
the index of this controller in the collection

getButtonCount

int getButtonCount()
Retrieve the number of buttons available on this controller.

Returns:
the number of buttons available on this controller
See Also:
AdvancedController.getPovCount(), getAxisCount(), AdvancedController.getBallCount()

getButtonName

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

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:
getButtonCount()

isButtonPressed

boolean isButtonPressed(int buttonIndex)
Check if a button is currently pressed

Parameters:
buttonIndex - the index of the button to check
Returns:
true if the button is currently pressed, false otherwise

poll

void poll()
Poll the controller for new data. Call this method before you query for inputs from a controller.


getPovX

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

Returns:
the X-Axis value of the first POV on this controller as float

getPovY

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

Returns:
the Y-Axis value of the first POV on this controller as float

getDeadZone

float getDeadZone(int axisIndex)
Get the dead zone for a specified axis.

Parameters:
axisIndex - the index of the axis for which to retrieve the dead zone (axis indices start with 0)
Returns:
the dead zone for the specified axis: a value from 0 to AXIS_MAXIMUM (1f)
See Also:
setDeadZone(int, float)

setDeadZone

void setDeadZone(int axisIndex,
                 float zone)
Set the dead zone for the specified axis. Analogue joysticks generally don't tend to return exactly to 0 once you stop holding the stick. Therefore it might seem that you are moving the direction stick, while in fact you are not. The dead zone is a "region" around the center where input is ignored. For example if you set the dead zone to 0.1f the values from -0.1f to 0.1f will be ignored (getAxisValue will return values from -1f to -0.1f, 0f or values from 0.1f to 1f).

Parameters:
axisIndex - the index of the axis for which to set the dead zone (axis indices start with 0)
zone - the dead zone to use for the specified axis: a value from 0 to AXIS_MAXIMUM (1f)
See Also:
getDeadZone(int)

getAxisCount

int getAxisCount()
Retrieve the number of axes available on this controller. Axes can are analogue inputs: their values can be anything from AXIS_MINIMUM to AXIS_MAXIMUM (-1f to 1f)

Returns:
the number of axes available on this controller
See Also:
getButtonCount(), AdvancedController.getPovCount(), AdvancedController.getBallCount()

getAxisName

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

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:
getAxisCount()

getAxisValue

float getAxisValue(int axisIndex)
Retrieve the value thats currently available on a specified axis. If the axis does not exist, AXIS_NEUTRAL (0f) will be returned. It may be useful to get the player to wiggle the joystick from side to side to get the calibration right.

Parameters:
axisIndex - the index of axis to be read (axis indices start with 0)
Returns:
the value from the specified axis: AXIS_NEUTRAL, AXIS_MINIMUM, AXIS_MAXIMUM or anything between AXIS_MINIMUM and AXIS_MAXIMUM (anything from -1f to 1f)

getXAxisValue

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

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:
getAxisValue(int)

getXAxisDeadZone

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

Returns:
the dead zone for the X axis
See Also:
setXAxisDeadZone(float), getDeadZone(int)

setXAxisDeadZone

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

Parameters:
zone - the dead zone to use for the X axis: a value from 0f to AXIS_MAXIMUM (1f)
See Also:
getXAxisDeadZone(), setDeadZone(int, float)

getYAxisValue

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

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:
getAxisValue(int)

getYAxisDeadZone

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

Returns:
the dead zone for the Y axis
See Also:
setYAxisDeadZone(float), getDeadZone(int)

setYAxisDeadZone

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

Parameters:
zone - the dead zone to use for the Y axis: a value from 0f to AXIS_MAXIMUM (1f)
See Also:
getYAxisDeadZone(), setDeadZone(int, float)

getZAxisValue

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

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:
getAxisValue(int)

getZAxisDeadZone

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

Returns:
the dead zone for the Z axis
See Also:
setZAxisDeadZone(float), getDeadZone(int)

setZAxisDeadZone

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

Parameters:
zone - the dead zone to use for the Z axis: a value from 0f to AXIS_MAXIMUM (1f)
See Also:
getZAxisDeadZone(), setDeadZone(int, float)

getRXAxisValue

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

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:
getAxisValue(int)

getRXAxisDeadZone

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

Returns:
the dead zone for the RX axis
See Also:
setRXAxisDeadZone(float), getDeadZone(int)

setRXAxisDeadZone

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

Parameters:
zone - the dead zone to use for the RX axis: a value from 0f to AXIS_MAXIMUM (1f)
See Also:
getRXAxisDeadZone(), setDeadZone(int, float)

getRYAxisValue

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

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:
getAxisValue(int)

getRYAxisDeadZone

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

Returns:
the dead zone for the RY axis
See Also:
setRYAxisDeadZone(float), getDeadZone(int)

setRYAxisDeadZone

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

Parameters:
zone - the dead zone to use for the RY axis: a value from 0f to AXIS_MAXIMUM (1f)
See Also:
getRYAxisDeadZone(), setDeadZone(int, float)

getRZAxisValue

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

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:
getAxisValue(int)

getRZAxisDeadZone

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

Returns:
the dead zone for the RZ axis
See Also:
setRZAxisDeadZone(float), getDeadZone(int)

setRZAxisDeadZone

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

Parameters:
zone - the dead zone to use for the RZ axis: a value from 0f to AXIS_MAXIMUM (1f)
See Also:
getRZAxisDeadZone(), setDeadZone(int, float)