Package org.lwjgl.util.input
Class ControllerAdapter
- java.lang.Object
-
- org.lwjgl.util.input.ControllerAdapter
-
- All Implemented Interfaces:
Controller
public class ControllerAdapter extends 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 intgetAxisCount()Retrieve the number of axes available on this controller.StringgetAxisName(int index)Get the name that's given to the specified axisfloatgetAxisValue(int index)Retrieve the value thats currently available on a specified axis.intgetButtonCount()Retrieve the number of buttons available on this controllerStringgetButtonName(int index)Get the name of the specified button.floatgetDeadZone(int index)Get the dead zone for a specified axisintgetIndex()Get the index of this controller in the collectionStringgetName()Get the name assigned to this controller.floatgetPovX()Get the X-Axis value of the POV on this controllerfloatgetPovY()Get the Y-Axis value of the POV on this controllerintgetRumblerCount()Returns the number of rumblers this controller supportsStringgetRumblerName(int index)Returns the name of the specified rumblerfloatgetRXAxisDeadZone()Get the dead zone for the RX axis.floatgetRXAxisValue()Get the value from the RX axis if there is one.floatgetRYAxisDeadZone()Get the dead zone for the RY axis.floatgetRYAxisValue()Get the value from the RY axis if there is one.floatgetRZAxisDeadZone()Get the dead zone for the RZ axis.floatgetRZAxisValue()Get the value from the RZ axis if there is one.floatgetXAxisDeadZone()Get the dead zone for the X axis.floatgetXAxisValue()Get the value from the X axis if there is one.floatgetYAxisDeadZone()Get the dead zone for the Y axis.floatgetYAxisValue()Get the value from the Y axis if there is one.floatgetZAxisDeadZone()Get the dead zone for the Z axis.floatgetZAxisValue()Get the value from the Z axis if there is one.booleanisButtonPressed(int index)Check if a button is currently pressedvoidpoll()Poll the controller for new data.voidsetDeadZone(int index, float zone)Set the dead zone for the specified axisvoidsetRumblerStrength(int index, float strength)Sets the vibration strength of the specified rumblervoidsetRXAxisDeadZone(float zone)Set the dead zone for the RX axisvoidsetRYAxisDeadZone(float zone)Set the dead zone for the RY axisvoidsetRZAxisDeadZone(float zone)Set the dead zone for the RZ axisvoidsetXAxisDeadZone(float zone)Set the dead zone for the X axisvoidsetYAxisDeadZone(float zone)Set the dead zone for the Y axisvoidsetZAxisDeadZone(float zone)Set the dead zone for the Z axis
-
-
-
Method Detail
-
getName
public String getName()
Get the name assigned to this controller.- Specified by:
getNamein interfaceController- Returns:
- The name assigned to this controller
-
getIndex
public int getIndex()
Get the index of this controller in the collection- Specified by:
getIndexin 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:
getButtonCountin interfaceController- Returns:
- The number of butotns available on this controller
-
getButtonName
public String getButtonName(int index)
Get the name of the specified button. Be warned, often this is as exciting as "Button X"- Specified by:
getButtonNamein 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:
isButtonPressedin 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:
pollin interfaceController
-
getPovX
public float getPovX()
Get the X-Axis value of the POV on this controller- Specified by:
getPovXin 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:
getPovYin 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:
getDeadZonein 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:
setDeadZonein 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:
getAxisCountin interfaceController- Returns:
- The number of axes available on this controller.
-
getAxisName
public String getAxisName(int index)
Get the name that's given to the specified axis- Specified by:
getAxisNamein 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:
getAxisValuein 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:
getXAxisValuein interfaceController- Returns:
- The value from the X axis
-
getXAxisDeadZone
public float getXAxisDeadZone()
Get the dead zone for the X axis.- Specified by:
getXAxisDeadZonein 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:
setXAxisDeadZonein 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:
getYAxisValuein interfaceController- Returns:
- The value from the Y axis
-
getYAxisDeadZone
public float getYAxisDeadZone()
Get the dead zone for the Y axis.- Specified by:
getYAxisDeadZonein 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:
setYAxisDeadZonein 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:
getZAxisValuein interfaceController- Returns:
- The value from the Z axis
-
getZAxisDeadZone
public float getZAxisDeadZone()
Get the dead zone for the Z axis.- Specified by:
getZAxisDeadZonein 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:
setZAxisDeadZonein 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:
getRXAxisValuein interfaceController- Returns:
- The value from the RX axis
-
getRXAxisDeadZone
public float getRXAxisDeadZone()
Get the dead zone for the RX axis.- Specified by:
getRXAxisDeadZonein 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:
setRXAxisDeadZonein 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:
getRYAxisValuein interfaceController- Returns:
- The value from the RY axis
-
getRYAxisDeadZone
public float getRYAxisDeadZone()
Get the dead zone for the RY axis.- Specified by:
getRYAxisDeadZonein 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:
setRYAxisDeadZonein 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:
getRZAxisValuein interfaceController- Returns:
- The value from the RZ axis
-
getRZAxisDeadZone
public float getRZAxisDeadZone()
Get the dead zone for the RZ axis.- Specified by:
getRZAxisDeadZonein 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:
setRZAxisDeadZonein interfaceController- Parameters:
zone- The dead zone to use for the RZ axis
-
getRumblerCount
public int getRumblerCount()
Description copied from interface:ControllerReturns the number of rumblers this controller supports- Specified by:
getRumblerCountin interfaceController
-
getRumblerName
public String getRumblerName(int index)
Description copied from interface:ControllerReturns the name of the specified rumbler- Specified by:
getRumblerNamein interfaceController- Parameters:
index- The rumbler index
-
setRumblerStrength
public void setRumblerStrength(int index, float strength)Description copied from interface:ControllerSets the vibration strength of the specified rumbler- Specified by:
setRumblerStrengthin interfaceController- Parameters:
index- The index of the rumblerstrength- The strength to vibrate at
-
-