net.jinx.action.input
Class ActionMap

java.lang.Object
  extended by net.jinx.action.input.ActionMap
All Implemented Interfaces:
Behavior

public class ActionMap
extends java.lang.Object
implements Behavior

Behavior implementation that maps input from an array of InputDevice objects to Action objects, which are then processed by the encapsulating Participant.

API Stability: Beta.


Constructor Summary
ActionMap()
          Constructs a new ActionMap with no InputDevices and no associations.
 
Method Summary
 void act(Participant p, float dt)
          Polls for input from the InputDevice attached to this ActionMap and then sends action data back to the calling Participant.
 void associate(ControlID id, java.lang.String action)
          Associates a control with an action.
 java.lang.String getAssociation(ControlID id)
          Gets the association for id.
 void setInputDevices(InputDevice[] devices)
          Sets the array of InputDevices to map from.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionMap

public ActionMap()
Constructs a new ActionMap with no InputDevices and no associations.

Method Detail

setInputDevices

public void setInputDevices(InputDevice[] devices)
Sets the array of InputDevices to map from.

Parameters:
devices - the array.

associate

public void associate(ControlID id,
                      java.lang.String action)
Associates a control with an action.

Parameters:
id - the ControlID to use to obtain input.
action - the String specifying name of the action that should be attached to the control. If this is null, it will remove any association for id.

getAssociation

public java.lang.String getAssociation(ControlID id)
Gets the association for id.

Parameters:
id - the controlID to get the associated action String for.

act

public void act(Participant p,
                float dt)
Polls for input from the InputDevice attached to this ActionMap and then sends action data back to the calling Participant.

Specified by:
act in interface Behavior
Parameters:
p - the Participant that needs a decision.
dt - the change in time value.