Package org.lwjgl.util.input
Class ControllerAdapter
- java.lang.Object
-
- org.lwjgl.util.input.ControllerAdapter
-
- All Implemented Interfaces:
Controller
public class ControllerAdapter extends java.lang.Object implements Controller
Adapter for the Controller interface. It can be used as placeholder Controller, which doesn't do anything (eg if Controllers.create() fails and you don't want to take care of that).- Author:
- Onyx, Aho and all the other aliases...
-
-
Constructor Summary
Constructors Constructor Description ControllerAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAxisCount()
Retrieve the number of axes available on this controller.java.lang.String
getAxisName(int index)
Get the name that's given to the specified axisfloat
getAxisValue(int index)
Retrieve the value thats currently available on a specified axis.int
getButtonCount()
Retrieve the number of buttons available on this controllerjava.lang.String
getButtonName(int index)
Get the name of the specified button.float
getDeadZone(int index)
Get the dead zone for a specified axisint
getIndex()
Get the index of this controller in the collectionjava.lang.String
getName()
Get the name assigned to this controller.float
getPovX()
Get the X-Axis value of the POV on this controllerfloat
getPovY()
Get the Y-Axis value of the POV on this controllerint
getRumblerCount()
Returns the number of rumblers this controller supportsjava.lang.String
getRumblerName(int index)
Returns the name of the specified rumblerfloat
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 index)
Check if a button is currently pressedvoid
poll()
Poll the controller for new data.void
setDeadZone(int index, float zone)
Set the dead zone for the specified axisvoid
setRumblerStrength(int index, float strength)
Sets the vibration strength of the specified rumblervoid
setRXAxisDeadZone(float zone)
Set the dead zone for the RX axisvoid
setRYAxisDeadZone(float zone)
Set the dead zone for the RY axisvoid
setRZAxisDeadZone(float zone)
Set the dead zone for the RZ axisvoid
setXAxisDeadZone(float zone)
Set the dead zone for the X axisvoid
setYAxisDeadZone(float zone)
Set the dead zone for the Y axisvoid
setZAxisDeadZone(float zone)
Set the dead zone for the Z axis
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Get the name assigned to this controller.- Specified by:
getName
in interfaceController
- Returns:
- The name assigned to this controller
-
getIndex
public int getIndex()
Get the index of this controller in the collection- Specified by:
getIndex
in interfaceController
- Returns:
- The index of this controller in the collection
-
getButtonCount
public int getButtonCount()
Retrieve the number of buttons available on this controller- Specified by:
getButtonCount
in interfaceController
- Returns:
- The number of butotns available on this controller
-
getButtonName
public java.lang.String getButtonName(int index)
Get the name of the specified button. Be warned, often this is as exciting as "Button X"- Specified by:
getButtonName
in interfaceController
- Parameters:
index
- The index of the button whose name should be retrieved- Returns:
- The name of the button requested
-
isButtonPressed
public boolean isButtonPressed(int index)
Check if a button is currently pressed- Specified by:
isButtonPressed
in interfaceController
- Parameters:
index
- The button to check- Returns:
- True if the button is currently pressed
-
poll
public void poll()
Poll the controller for new data. This will also update events- Specified by:
poll
in interfaceController
-
getPovX
public float getPovX()
Get the X-Axis value of the POV on this controller- Specified by:
getPovX
in interfaceController
- Returns:
- The X-Axis value of the POV on this controller
-
getPovY
public float getPovY()
Get the Y-Axis value of the POV on this controller- Specified by:
getPovY
in interfaceController
- Returns:
- The Y-Axis value of the POV on this controller
-
getDeadZone
public float getDeadZone(int index)
Get the dead zone for a specified axis- Specified by:
getDeadZone
in interfaceController
- Parameters:
index
- The index of the axis for which to retrieve the dead zone- Returns:
- The dead zone for the specified axis
-
setDeadZone
public void setDeadZone(int index, float zone)
Set the dead zone for the specified axis- Specified by:
setDeadZone
in interfaceController
- Parameters:
index
- The index of hte axis for which to set the dead zonezone
- The dead zone to use for the specified axis
-
getAxisCount
public int getAxisCount()
Retrieve the number of axes available on this controller.- Specified by:
getAxisCount
in interfaceController
- Returns:
- The number of axes available on this controller.
-
getAxisName
public java.lang.String getAxisName(int index)
Get the name that's given to the specified axis- Specified by:
getAxisName
in interfaceController
- Parameters:
index
- The index of the axis whose name should be retrieved- Returns:
- The name of the specified axis.
-
getAxisValue
public float getAxisValue(int index)
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.- Specified by:
getAxisValue
in interfaceController
- Parameters:
index
- The index of axis to be read- Returns:
- The value from the specified axis.
-
getXAxisValue
public float getXAxisValue()
Get the value from the X axis if there is one. If no X axis is defined a zero value will be returned.- Specified by:
getXAxisValue
in interfaceController
- Returns:
- The value from the X axis
-
getXAxisDeadZone
public float getXAxisDeadZone()
Get the dead zone for the X axis.- Specified by:
getXAxisDeadZone
in interfaceController
- Returns:
- The dead zone for the X axis
-
setXAxisDeadZone
public void setXAxisDeadZone(float zone)
Set the dead zone for the X axis- Specified by:
setXAxisDeadZone
in interfaceController
- Parameters:
zone
- The dead zone to use for the X axis
-
getYAxisValue
public float getYAxisValue()
Get the value from the Y axis if there is one. If no Y axis is defined a zero value will be returned.- Specified by:
getYAxisValue
in interfaceController
- Returns:
- The value from the Y axis
-
getYAxisDeadZone
public float getYAxisDeadZone()
Get the dead zone for the Y axis.- Specified by:
getYAxisDeadZone
in interfaceController
- Returns:
- The dead zone for the Y axis
-
setYAxisDeadZone
public void setYAxisDeadZone(float zone)
Set the dead zone for the Y axis- Specified by:
setYAxisDeadZone
in interfaceController
- Parameters:
zone
- The dead zone to use for the Y axis
-
getZAxisValue
public float getZAxisValue()
Get the value from the Z axis if there is one. If no Z axis is defined a zero value will be returned.- Specified by:
getZAxisValue
in interfaceController
- Returns:
- The value from the Z axis
-
getZAxisDeadZone
public float getZAxisDeadZone()
Get the dead zone for the Z axis.- Specified by:
getZAxisDeadZone
in interfaceController
- Returns:
- The dead zone for the Z axis
-
setZAxisDeadZone
public void setZAxisDeadZone(float zone)
Set the dead zone for the Z axis- Specified by:
setZAxisDeadZone
in interfaceController
- Parameters:
zone
- The dead zone to use for the Z axis
-
getRXAxisValue
public float getRXAxisValue()
Get the value from the RX axis if there is one. If no RX axis is defined a zero value will be returned.- Specified by:
getRXAxisValue
in interfaceController
- Returns:
- The value from the RX axis
-
getRXAxisDeadZone
public float getRXAxisDeadZone()
Get the dead zone for the RX axis.- Specified by:
getRXAxisDeadZone
in interfaceController
- Returns:
- The dead zone for the RX axis
-
setRXAxisDeadZone
public void setRXAxisDeadZone(float zone)
Set the dead zone for the RX axis- Specified by:
setRXAxisDeadZone
in interfaceController
- Parameters:
zone
- The dead zone to use for the RX axis
-
getRYAxisValue
public float getRYAxisValue()
Get the value from the RY axis if there is one. If no RY axis is defined a zero value will be returned.- Specified by:
getRYAxisValue
in interfaceController
- Returns:
- The value from the RY axis
-
getRYAxisDeadZone
public float getRYAxisDeadZone()
Get the dead zone for the RY axis.- Specified by:
getRYAxisDeadZone
in interfaceController
- Returns:
- The dead zone for the RY axis
-
setRYAxisDeadZone
public void setRYAxisDeadZone(float zone)
Set the dead zone for the RY axis- Specified by:
setRYAxisDeadZone
in interfaceController
- Parameters:
zone
- The dead zone to use for the RY axis
-
getRZAxisValue
public float getRZAxisValue()
Get the value from the RZ axis if there is one. If no RZ axis is defined a zero value will be returned.- Specified by:
getRZAxisValue
in interfaceController
- Returns:
- The value from the RZ axis
-
getRZAxisDeadZone
public float getRZAxisDeadZone()
Get the dead zone for the RZ axis.- Specified by:
getRZAxisDeadZone
in interfaceController
- Returns:
- The dead zone for the RZ axis
-
setRZAxisDeadZone
public void setRZAxisDeadZone(float zone)
Set the dead zone for the RZ axis- Specified by:
setRZAxisDeadZone
in interfaceController
- Parameters:
zone
- The dead zone to use for the RZ axis
-
getRumblerCount
public int getRumblerCount()
Description copied from interface:Controller
Returns the number of rumblers this controller supports- Specified by:
getRumblerCount
in interfaceController
-
getRumblerName
public java.lang.String getRumblerName(int index)
Description copied from interface:Controller
Returns the name of the specified rumbler- Specified by:
getRumblerName
in interfaceController
- Parameters:
index
- The rumbler index
-
setRumblerStrength
public void setRumblerStrength(int index, float strength)
Description copied from interface:Controller
Sets the vibration strength of the specified rumbler- Specified by:
setRumblerStrength
in interfaceController
- Parameters:
index
- The index of the rumblerstrength
- The strength to vibrate at
-
-