com.jme.input.util
Class TwoButtonAxis

java.lang.Object
  extended by com.jme.input.util.SyntheticTriggerContainer
      extended by com.jme.input.util.SyntheticAxis
          extended by com.jme.input.util.TwoButtonAxis

public class TwoButtonAxis
extends SyntheticAxis

This is a utility class to simulate an axis from two buttons (or keys). For a usage example see TestInputHandler.


Field Summary
 
Fields inherited from class com.jme.input.util.SyntheticAxis
name
 
Constructor Summary
TwoButtonAxis(java.lang.String name)
           
 
Method Summary
 InputAction getDecreaseAction()
          The returned action should be subscribed with an InputHandler to be invoked any time the axis should decrease.
 InputAction getIncreaseAction()
          The returned action should be subscribed with an InputHandler to be invoked any time the axis should increase.
 float getValue()
           
 boolean isDiscreet()
           
 void setDiscreet(boolean discreet)
           
 
Methods inherited from class com.jme.input.util.SyntheticAxis
add, createTrigger, getDeviceName, getIndex, getName, remove, setIndex, trigger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwoButtonAxis

public TwoButtonAxis(java.lang.String name)
Parameters:
name - the name of this new axis
Method Detail

getValue

public float getValue()
Returns:
current value/position of this axis

isDiscreet

public boolean isDiscreet()
Returns:
true if a single keystoke changes the axis value by the action speed, false if continuous (multiplied with frame time)

setDiscreet

public void setDiscreet(boolean discreet)
Parameters:
discreet - true if a single keystoke should change the axis value by the action speed, false if continuous (multiplied with frame time)

getDecreaseAction

public InputAction getDecreaseAction()
The returned action should be subscribed with an InputHandler to be invoked any time the axis should decrease. When isDiscreet() is true it is commonly registed with allowRepeats==false, while allowRepeats should be true when isDiscreet() is false.

Returns:
the action that decreases the axis value

getIncreaseAction

public InputAction getIncreaseAction()
The returned action should be subscribed with an InputHandler to be invoked any time the axis should increase. When isDiscreet() is true it is commonly registed with allowRepeats==false, while allowRepeats should be true when isDiscreet() is false.

Returns:
the action that increases the axis value