Top Description Fields Constructors Methods
org.lwjgl.input

pack-priv Class JInputController

extends Object
implements Controller
Class Inheritance
All Implemented Interfaces
org.lwjgl.input.Controller
Imports
java.util.ArrayList, net.java.games.input.Component, .Component.Identifier.Axis, .Component.Identifier.Button, .Event, .EventQueue, .Rumbler

A wrapper round a JInput controller that attempts to make the interface more useable.
Author
Kevin Glass

Field Summary

Modifier and TypeField and Description
private ArrayList<Component>
axes

The Axes that have been detected on the JInput controller

private float[]
axesMax

The maximum values read for each axis

private float[]
axesValue

The values that were read from the axes last check

private ArrayList<Component>
buttons

The Buttons that have been detected on the JInput controller

private boolean[]
buttonState

The state of the buttons last check

private float[]
deadZones

The dead zones for each axis

private int
index

The index that has been assigned to this controller

private ArrayList<Component>
pov

The POVs that have been detected on the JInput controller

private float[]
povValues

The values that were read from the pov last check

private Rumbler[]
rumblers

The rumblers exposed by the controller

private int
rxaxis

The index of the RX axis or -1 if no RX axis is defined

private int
ryaxis

The index of the RY axis or -1 if no RY axis is defined

private int
rzaxis

The index of the RZ axis or -1 if no RZ axis is defined

private Controller
target

The JInput controller this class is wrapping

private int
xaxis

The index of the X axis or -1 if no X axis is defined

private int
yaxis

The index of the Y axis or -1 if no Y axis is defined

private int
zaxis

The index of the X axis or -1 if no Z axis is defined

Constructor Summary

AccessConstructor and Description
pack-priv
JInputController(int
The index this controller has been assigned to
index
,
Controller
The target JInput controller this class is wrapping
target
)

Create a new controller that wraps round a JInput controller and hopefully makes it easier to use.

Method Summary

Modifier and TypeMethod and Description
public int
getAxisCount()

Implements org.lwjgl.input.Controller.getAxisCount.

Retrieve the number of axes available on this controller.
public String
getAxisName(int
The index of the axis whose name should be retrieved
index
)

Implements org.lwjgl.input.Controller.getAxisName.

Get the name that's given to the specified axis
public float
getAxisValue(int
The index of axis to be read
index
)

Implements org.lwjgl.input.Controller.getAxisValue.

Retrieve the value thats currently available on a specified axis.
public int
getButtonCount()

Implements org.lwjgl.input.Controller.getButtonCount.

Retrieve the number of buttons available on this controller
public String
getButtonName(int
The index of the button whose name should be retrieved
index
)

Implements org.lwjgl.input.Controller.getButtonName.

Get the name of the specified button.
public float
getDeadZone(int
The index of the axis for which to retrieve the dead zone
index
)

Implements org.lwjgl.input.Controller.getDeadZone.

Get the dead zone for a specified axis
public int
getIndex()

Implements org.lwjgl.input.Controller.getIndex.

Get the index of this controller in the collection
public String
getName()

Implements org.lwjgl.input.Controller.getName.

Get the name assigned to this controller.
public float
getPovX()

Implements org.lwjgl.input.Controller.getPovX.

Get the X-Axis value of the POV on this controller
public float
getPovY()

Implements org.lwjgl.input.Controller.getPovY.

Get the Y-Axis value of the POV on this controller
public int
getRumblerCount()

Implements org.lwjgl.input.Controller.getRumblerCount.

Returns the number of rumblers this controller supports
public String
getRumblerName(int
The rumbler index
index
)

Implements org.lwjgl.input.Controller.getRumblerName.

Returns the name of the specified rumbler
public float
getRXAxisDeadZone()

Implements org.lwjgl.input.Controller.getRXAxisDeadZone.

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

Implements org.lwjgl.input.Controller.getRXAxisValue.

Get the value from the RX axis if there is one.
public float
getRYAxisDeadZone()

Implements org.lwjgl.input.Controller.getRYAxisDeadZone.

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

Implements org.lwjgl.input.Controller.getRYAxisValue.

Get the value from the RY axis if there is one.
public float
getRZAxisDeadZone()

Implements org.lwjgl.input.Controller.getRZAxisDeadZone.

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

Implements org.lwjgl.input.Controller.getRZAxisValue.

Get the value from the RZ axis if there is one.
public float
getXAxisDeadZone()

Implements org.lwjgl.input.Controller.getXAxisDeadZone.

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

Implements org.lwjgl.input.Controller.getXAxisValue.

Get the value from the X axis if there is one.
public float
getYAxisDeadZone()

Implements org.lwjgl.input.Controller.getYAxisDeadZone.

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

Implements org.lwjgl.input.Controller.getYAxisValue.

Get the value from the Y axis if there is one.
public float
getZAxisDeadZone()

Implements org.lwjgl.input.Controller.getZAxisDeadZone.

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

Implements org.lwjgl.input.Controller.getZAxisValue.

Get the value from the Z axis if there is one.
public boolean
isButtonPressed(int
The button to check
index
)

Implements org.lwjgl.input.Controller.isButtonPressed.

Check if a button is currently pressed
public void
poll()

Implements org.lwjgl.input.Controller.poll.

Poll the controller for new data.
public void
setDeadZone(int
The index of hte axis for which to set the dead zone
index
,
float
The dead zone to use for the specified axis
zone
)

Implements org.lwjgl.input.Controller.setDeadZone.

Set the dead zone for the specified axis
public void
setRumblerStrength(int
The index of the rumbler
index
,
float
The strength to vibrate at
strength
)

Implements org.lwjgl.input.Controller.setRumblerStrength.

Sets the vibration strength of the specified rumbler
public void
setRXAxisDeadZone(float
The dead zone to use for the RX axis
zone
)

Implements org.lwjgl.input.Controller.setRXAxisDeadZone.

Set the dead zone for the RX axis
public void
setRYAxisDeadZone(float
The dead zone to use for the RY axis
zone
)

Implements org.lwjgl.input.Controller.setRYAxisDeadZone.

Set the dead zone for the RY axis
public void
setRZAxisDeadZone(float
The dead zone to use for the RZ axis
zone
)

Implements org.lwjgl.input.Controller.setRZAxisDeadZone.

Set the dead zone for the RZ axis
public void
setXAxisDeadZone(float
The dead zone to use for the X axis
zone
)

Implements org.lwjgl.input.Controller.setXAxisDeadZone.

Set the dead zone for the X axis
public void
setYAxisDeadZone(float
The dead zone to use for the Y axis
zone
)

Implements org.lwjgl.input.Controller.setYAxisDeadZone.

Set the dead zone for the Y axis
public void
setZAxisDeadZone(float
The dead zone to use for the Z axis
zone
)

Implements org.lwjgl.input.Controller.setZAxisDeadZone.

Set the dead zone for the Z axis
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

axesback to summary
private ArrayList<Component> axes

The Axes that have been detected on the JInput controller

axesMaxback to summary
private float[] axesMax

The maximum values read for each axis

axesValueback to summary
private float[] axesValue

The values that were read from the axes last check

buttonsback to summary
private ArrayList<Component> buttons

The Buttons that have been detected on the JInput controller

buttonStateback to summary
private boolean[] buttonState

The state of the buttons last check

deadZonesback to summary
private float[] deadZones

The dead zones for each axis

indexback to summary
private int index

The index that has been assigned to this controller

povback to summary
private ArrayList<Component> pov

The POVs that have been detected on the JInput controller

povValuesback to summary
private float[] povValues

The values that were read from the pov last check

rumblersback to summary
private Rumbler[] rumblers

The rumblers exposed by the controller

rxaxisback to summary
private int rxaxis

The index of the RX axis or -1 if no RX axis is defined

ryaxisback to summary
private int ryaxis

The index of the RY axis or -1 if no RY axis is defined

rzaxisback to summary
private int rzaxis

The index of the RZ axis or -1 if no RZ axis is defined

targetback to summary
private Controller target

The JInput controller this class is wrapping

xaxisback to summary
private int xaxis

The index of the X axis or -1 if no X axis is defined

yaxisback to summary
private int yaxis

The index of the Y axis or -1 if no Y axis is defined

zaxisback to summary
private int zaxis

The index of the X axis or -1 if no Z axis is defined

Constructor Detail

JInputControllerback to summary
pack-priv JInputController(int index, Controller target)

Create a new controller that wraps round a JInput controller and hopefully makes it easier to use.

Parameters
index:int

The index this controller has been assigned to

target:Controller

The target JInput controller this class is wrapping

Method Detail

getAxisCountback to summary
public int getAxisCount()

Implements org.lwjgl.input.Controller.getAxisCount.

Doc from org.lwjgl.input.Controller.getAxisCount.

Retrieve the number of axes available on this controller.

Returns:int

The number of axes available on this controller.

getAxisNameback to summary
public String getAxisName(int index)

Implements org.lwjgl.input.Controller.getAxisName.

Doc from org.lwjgl.input.Controller.getAxisName.

Get the name that's given to the specified axis

Parameters
index:int

The index of the axis whose name should be retrieved

Returns:String

The name of the specified axis.

getAxisValueback to summary
public float getAxisValue(int index)

Implements org.lwjgl.input.Controller.getAxisValue.

Doc from org.lwjgl.input.Controller.getAxisValue.

Retrieve the value thats currently available on a specified axis. The value will always be between 1.0 and -1.0 and will calibrate as values are passed read. It may be useful to get the player to wiggle the joystick from side to side to get the calibration right.

Parameters
index:int

The index of axis to be read

Returns:float

The value from the specified axis.

getButtonCountback to summary
public int getButtonCount()

Implements org.lwjgl.input.Controller.getButtonCount.

Doc from org.lwjgl.input.Controller.getButtonCount.

Retrieve the number of buttons available on this controller

Returns:int

The number of butotns available on this controller

getButtonNameback to summary
public String getButtonName(int index)

Implements org.lwjgl.input.Controller.getButtonName.

Doc from org.lwjgl.input.Controller.getButtonName.

Get the name of the specified button. Be warned, often this is as exciting as "Button X"

Parameters
index:int

The index of the button whose name should be retrieved

Returns:String

The name of the button requested

getDeadZoneback to summary
public float getDeadZone(int index)

Implements org.lwjgl.input.Controller.getDeadZone.

Doc from org.lwjgl.input.Controller.getDeadZone.

Get the dead zone for a specified axis

Parameters
index:int

The index of the axis for which to retrieve the dead zone

Returns:float

The dead zone for the specified axis

getIndexback to summary
public int getIndex()

Implements org.lwjgl.input.Controller.getIndex.

Doc from org.lwjgl.input.Controller.getIndex.

Get the index of this controller in the collection

Returns:int

The index of this controller in the collection

getNameback to summary
public String getName()

Implements org.lwjgl.input.Controller.getName.

Doc from org.lwjgl.input.Controller.getName.

Get the name assigned to this controller.

Returns:String

The name assigned to this controller

getPovXback to summary
public float getPovX()

Implements org.lwjgl.input.Controller.getPovX.

Doc from org.lwjgl.input.Controller.getPovX.

Get the X-Axis value of the POV on this controller

Returns:float

The X-Axis value of the POV on this controller

getPovYback to summary
public float getPovY()

Implements org.lwjgl.input.Controller.getPovY.

Doc from org.lwjgl.input.Controller.getPovY.

Get the Y-Axis value of the POV on this controller

Returns:float

The Y-Axis value of the POV on this controller

getRumblerCountback to summary
public int getRumblerCount()

Implements org.lwjgl.input.Controller.getRumblerCount.

Doc from org.lwjgl.input.Controller.getRumblerCount.

Returns the number of rumblers this controller supports

getRumblerNameback to summary
public String getRumblerName(int index)

Implements org.lwjgl.input.Controller.getRumblerName.

Doc from org.lwjgl.input.Controller.getRumblerName.

Returns the name of the specified rumbler

Parameters
index:int

The rumbler index

getRXAxisDeadZoneback to summary
public float getRXAxisDeadZone()

Implements org.lwjgl.input.Controller.getRXAxisDeadZone.

Doc from org.lwjgl.input.Controller.getRXAxisDeadZone.

Get the dead zone for the RX axis.

Returns:float

The dead zone for the RX axis

getRXAxisValueback to summary
public float getRXAxisValue()

Implements org.lwjgl.input.Controller.getRXAxisValue.

Doc from org.lwjgl.input.Controller.getRXAxisValue.

Get the value from the RX axis if there is one. If no RX axis is defined a zero value will be returned.

Returns:float

The value from the RX axis

getRYAxisDeadZoneback to summary
public float getRYAxisDeadZone()

Implements org.lwjgl.input.Controller.getRYAxisDeadZone.

Doc from org.lwjgl.input.Controller.getRYAxisDeadZone.

Get the dead zone for the RY axis.

Returns:float

The dead zone for the RY axis

getRYAxisValueback to summary
public float getRYAxisValue()

Implements org.lwjgl.input.Controller.getRYAxisValue.

Doc from org.lwjgl.input.Controller.getRYAxisValue.

Get the value from the RY axis if there is one. If no RY axis is defined a zero value will be returned.

Returns:float

The value from the RY axis

getRZAxisDeadZoneback to summary
public float getRZAxisDeadZone()

Implements org.lwjgl.input.Controller.getRZAxisDeadZone.

Doc from org.lwjgl.input.Controller.getRZAxisDeadZone.

Get the dead zone for the RZ axis.

Returns:float

The dead zone for the RZ axis

getRZAxisValueback to summary
public float getRZAxisValue()

Implements org.lwjgl.input.Controller.getRZAxisValue.

Doc from org.lwjgl.input.Controller.getRZAxisValue.

Get the value from the RZ axis if there is one. If no RZ axis is defined a zero value will be returned.

Returns:float

The value from the RZ axis

getXAxisDeadZoneback to summary
public float getXAxisDeadZone()

Implements org.lwjgl.input.Controller.getXAxisDeadZone.

Doc from org.lwjgl.input.Controller.getXAxisDeadZone.

Get the dead zone for the X axis.

Returns:float

The dead zone for the X axis

getXAxisValueback to summary
public float getXAxisValue()

Implements org.lwjgl.input.Controller.getXAxisValue.

Doc from org.lwjgl.input.Controller.getXAxisValue.

Get the value from the X axis if there is one. If no X axis is defined a zero value will be returned.

Returns:float

The value from the X axis

getYAxisDeadZoneback to summary
public float getYAxisDeadZone()

Implements org.lwjgl.input.Controller.getYAxisDeadZone.

Doc from org.lwjgl.input.Controller.getYAxisDeadZone.

Get the dead zone for the Y axis.

Returns:float

The dead zone for the Y axis

getYAxisValueback to summary
public float getYAxisValue()

Implements org.lwjgl.input.Controller.getYAxisValue.

Doc from org.lwjgl.input.Controller.getYAxisValue.

Get the value from the Y axis if there is one. If no Y axis is defined a zero value will be returned.

Returns:float

The value from the Y axis

getZAxisDeadZoneback to summary
public float getZAxisDeadZone()

Implements org.lwjgl.input.Controller.getZAxisDeadZone.

Doc from org.lwjgl.input.Controller.getZAxisDeadZone.

Get the dead zone for the Z axis.

Returns:float

The dead zone for the Z axis

getZAxisValueback to summary
public float getZAxisValue()

Implements org.lwjgl.input.Controller.getZAxisValue.

Doc from org.lwjgl.input.Controller.getZAxisValue.

Get the value from the Z axis if there is one. If no Z axis is defined a zero value will be returned.

Returns:float

The value from the Z axis

isButtonPressedback to summary
public boolean isButtonPressed(int index)

Implements org.lwjgl.input.Controller.isButtonPressed.

Doc from org.lwjgl.input.Controller.isButtonPressed.

Check if a button is currently pressed

Parameters
index:int

The button to check

Returns:boolean

True if the button is currently pressed

pollback to summary
public void poll()

Implements org.lwjgl.input.Controller.poll.

Doc from org.lwjgl.input.Controller.poll.

Poll the controller for new data. This will also update events

setDeadZoneback to summary
public void setDeadZone(int index, float zone)

Implements org.lwjgl.input.Controller.setDeadZone.

Doc from org.lwjgl.input.Controller.setDeadZone.

Set the dead zone for the specified axis

Parameters
index:int

The index of hte axis for which to set the dead zone

zone:float

The dead zone to use for the specified axis

setRumblerStrengthback to summary
public void setRumblerStrength(int index, float strength)

Implements org.lwjgl.input.Controller.setRumblerStrength.

Doc from org.lwjgl.input.Controller.setRumblerStrength.

Sets the vibration strength of the specified rumbler

Parameters
index:int

The index of the rumbler

strength:float

The strength to vibrate at

setRXAxisDeadZoneback to summary
public void setRXAxisDeadZone(float zone)

Implements org.lwjgl.input.Controller.setRXAxisDeadZone.

Doc from org.lwjgl.input.Controller.setRXAxisDeadZone.

Set the dead zone for the RX axis

Parameters
zone:float

The dead zone to use for the RX axis

setRYAxisDeadZoneback to summary
public void setRYAxisDeadZone(float zone)

Implements org.lwjgl.input.Controller.setRYAxisDeadZone.

Doc from org.lwjgl.input.Controller.setRYAxisDeadZone.

Set the dead zone for the RY axis

Parameters
zone:float

The dead zone to use for the RY axis

setRZAxisDeadZoneback to summary
public void setRZAxisDeadZone(float zone)

Implements org.lwjgl.input.Controller.setRZAxisDeadZone.

Doc from org.lwjgl.input.Controller.setRZAxisDeadZone.

Set the dead zone for the RZ axis

Parameters
zone:float

The dead zone to use for the RZ axis

setXAxisDeadZoneback to summary
public void setXAxisDeadZone(float zone)

Implements org.lwjgl.input.Controller.setXAxisDeadZone.

Doc from org.lwjgl.input.Controller.setXAxisDeadZone.

Set the dead zone for the X axis

Parameters
zone:float

The dead zone to use for the X axis

setYAxisDeadZoneback to summary
public void setYAxisDeadZone(float zone)

Implements org.lwjgl.input.Controller.setYAxisDeadZone.

Doc from org.lwjgl.input.Controller.setYAxisDeadZone.

Set the dead zone for the Y axis

Parameters
zone:float

The dead zone to use for the Y axis

setZAxisDeadZoneback to summary
public void setZAxisDeadZone(float zone)

Implements org.lwjgl.input.Controller.setZAxisDeadZone.

Doc from org.lwjgl.input.Controller.setZAxisDeadZone.

Set the dead zone for the Z axis

Parameters
zone:float

The dead zone to use for the Z axis