org.jagatoo.input.devices.components
Class AnalogDeviceComponent

java.lang.Object
  extended by org.jagatoo.input.devices.components.DeviceComponent
      extended by org.jagatoo.input.devices.components.AnalogDeviceComponent
Direct Known Subclasses:
ControllerAxis, MouseAxis, MouseWheel

public class AnalogDeviceComponent
extends DeviceComponent

Abstraction of all DeviceComponents, that can have values in a range.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jagatoo.input.devices.components.DeviceComponent
DeviceComponent.Type
 
Field Summary
 
Fields inherited from class org.jagatoo.input.devices.components.DeviceComponent
nextID
 
Constructor Summary
protected AnalogDeviceComponent(DeviceComponent.Type type, java.lang.String name)
          Creates a new AnalogDeviceComponent.
 
Method Summary
 void addValue(float deltaValue)
           
 void addValue(int deltaValue)
           
 float getFloatValue()
           
 int getIntValue()
           
 float getScale()
           
 void setScale(float scale)
          Sets the scale factor to convert the int- and float-values.
 void setValue(float value)
           
 void setValue(int value)
           
protected  void setValue(int intValue, float floatValue)
           
 
Methods inherited from class org.jagatoo.input.devices.components.DeviceComponent
bindAction, bindAction, getDeviceComponentID, getLocalizedName, getName, getType, isAnalog, isDigital, notifyBoundActions, unbindAction, unbindAction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnalogDeviceComponent

protected AnalogDeviceComponent(DeviceComponent.Type type,
                                java.lang.String name)
Creates a new AnalogDeviceComponent.

Parameters:
type - the type
name - the component's name
Method Detail

setValue

protected void setValue(int intValue,
                        float floatValue)

setValue

public final void setValue(int value)

setValue

public final void setValue(float value)

addValue

public final void addValue(int deltaValue)

addValue

public final void addValue(float deltaValue)

getIntValue

public final int getIntValue()
Returns:
the current value as an int. This is always scale * floatValue.

getFloatValue

public final float getFloatValue()
Returns:
the current value as a float. This is always intValue / scale.

setScale

public void setScale(float scale)
Sets the scale factor to convert the int- and float-values.

Parameters:
scale -

getScale

public final float getScale()
Returns:
the scale factor to convert the int- and float-values.