net.jinx.action.input.robot
Class ButtonControl

java.lang.Object
  extended by net.jinx.action.input.robot.AbstractControl
      extended by net.jinx.action.input.robot.ButtonControl
All Implemented Interfaces:
Control
Direct Known Subclasses:
ToggleButtonControl

public abstract class ButtonControl
extends AbstractControl

ButtonControl is an AbstractControl extension that converts it's input values to a boolean state. It can be in either a pressed or released state.

API Stability: Alpha.


Field Summary
 
Fields inherited from interface net.jinx.action.input.robot.Control
TYPE_AXIS, TYPE_BUTTON, TYPE_SLIDER, TYPE_TOGGLE
 
Constructor Summary
protected ButtonControl(java.lang.String name)
          Constructs a new ButtonControl with the given name.
 
Method Summary
 boolean isOn()
          Determines if this ButtonControl is currently on.
 boolean isPressed()
          Determines if this ButtonControl is currently pressed.
protected abstract  void pressed()
          Called when the state has changed from released to pressed.
protected abstract  void released()
          Called when the state has changed from pressed to released.
 void setValue(float value)
          Rounds value to either zero or one.
protected  void valueChange()
          Calls pressed() or released() according to whether or not isPressed() returns true.
 
Methods inherited from class net.jinx.action.input.robot.AbstractControl
getName, getType, getValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ButtonControl

protected ButtonControl(java.lang.String name)
Constructs a new ButtonControl with the given name.

Parameters:
name - the name to use for this Control.
Method Detail

setValue

public void setValue(float value)
Rounds value to either zero or one. Then it does the same thing as the superclass.

Specified by:
setValue in interface Control
Overrides:
setValue in class AbstractControl
Parameters:
value - the new value.

isPressed

public boolean isPressed()
Determines if this ButtonControl is currently pressed.

Returns:
true if it's pressed.

isOn

public boolean isOn()
Determines if this ButtonControl is currently on. This has the same return value as isPressed(), but subclasses may differ.

Returns:
true if this ButtonControl is currently pressed.

valueChange

protected void valueChange()
Calls pressed() or released() according to whether or not isPressed() returns true.

Specified by:
valueChange in class AbstractControl

pressed

protected abstract void pressed()
Called when the state has changed from released to pressed.


released

protected abstract void released()
Called when the state has changed from pressed to released.