org.lwjgl.util.input
Class ControllerAdapter

java.lang.Object
  extended by 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
ControllerAdapter()
           
 
Method Summary
 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 axis
 float getAxisValue(int index)
          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 index)
          Get the name of the specified button.
 float getDeadZone(int index)
          Get the dead zone for a specified axis
 int getIndex()
          Get the index of this controller in the collection
 java.lang.String getName()
          Get the name assigned to this controller.
 float getPovX()
          Get the X-Axis value of the POV on this controller
 float getPovY()
          Get the Y-Axis value of the POV on this controller
 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 index)
          Check if a button is currently pressed
 void poll()
          Poll the controller for new data.
 void setDeadZone(int index, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ControllerAdapter

public ControllerAdapter()
Method Detail

getName

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

Specified by:
getName in interface Controller
Returns:
The name assigned to this controller

getIndex

public int getIndex()
Get the index of this controller in the collection

Specified by:
getIndex in interface Controller
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 interface Controller
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 interface Controller
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 interface Controller
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 interface Controller

getPovX

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

Specified by:
getPovX in interface Controller
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 interface Controller
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 interface Controller
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 interface Controller
Parameters:
index - The index of hte axis for which to set the dead zone
zone - 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 interface Controller
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 interface Controller
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 interface Controller
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 interface Controller
Returns:
The value from the X axis

getXAxisDeadZone

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

Specified by:
getXAxisDeadZone in interface Controller
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 interface Controller
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 interface Controller
Returns:
The value from the Y axis

getYAxisDeadZone

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

Specified by:
getYAxisDeadZone in interface Controller
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 interface Controller
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 interface Controller
Returns:
The value from the Z axis

getZAxisDeadZone

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

Specified by:
getZAxisDeadZone in interface Controller
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 interface Controller
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 interface Controller
Returns:
The value from the RX axis

getRXAxisDeadZone

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

Specified by:
getRXAxisDeadZone in interface Controller
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 interface Controller
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 interface Controller
Returns:
The value from the RY axis

getRYAxisDeadZone

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

Specified by:
getRYAxisDeadZone in interface Controller
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 interface Controller
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 interface Controller
Returns:
The value from the RZ axis

getRZAxisDeadZone

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

Specified by:
getRZAxisDeadZone in interface Controller
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 interface Controller
Parameters:
zone - The dead zone to use for the RZ axis


Copyright © 2002-2009 lwjgl.org. All Rights Reserved.