org.jagatoo.input.managers
Class InputStatesManager

java.lang.Object
  extended by org.jagatoo.input.managers.InputStatesManager

public class InputStatesManager
extends java.lang.Object

Manages state-changes on any kind of InputDevice.


Field Summary
static int CONTROLLERS_SUSPENDED
           
static int KEYBOARD_SUSPENDED
           
static int MOUSE_AXES_SUSPENDED
           
static int MOUSE_BUTTONS_SUSPENDED
           
static int MOUSE_WHEEL_SUSPENDED
           
 
Constructor Summary
InputStatesManager(InputBindingsManager<? extends InputAction> bindingsManager)
          Creates a new InputStatesManager.
 
Method Summary
 InputAction[] getActionsByState(InputState state)
          Fills all InputActions, that currently have the requested InputState, into an array.
 int getActionsByState(InputState state, InputAction[] actions)
          Fills all InputActions into the array, that currently have the requested InputState.
 void getActionsByState(InputState state, java.util.List<? super InputAction> actions)
          Fills all InputActions into the list, that currently have the requested InputState.
 void getActionsByState(InputState state, java.util.List<? super InputAction> actions, boolean clearListBefore)
          Fills all InputActions into the list, that currently have the requested InputState.
 InputState getInputState(InputAction action)
           
 InputStatesManipulator getInputStatesManipulator()
           
 InputStatesManipulator getKeyStatesManipulator()
          Deprecated. renamed to getInputStatesManipulator()
 int getNumStates()
           
 int getSimpleInputState(InputAction action)
           
 int getSuspendMask()
           
 boolean hasInputStateChanged(InputAction action)
           
 void setSuspendMask(int suspendMask)
          Suspends or resumes this InputStatesManager.
 void update(long nanoTime)
          Updates the key-states array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MOUSE_AXES_SUSPENDED

public static final int MOUSE_AXES_SUSPENDED
See Also:
Constant Field Values

MOUSE_BUTTONS_SUSPENDED

public static final int MOUSE_BUTTONS_SUSPENDED
See Also:
Constant Field Values

MOUSE_WHEEL_SUSPENDED

public static final int MOUSE_WHEEL_SUSPENDED
See Also:
Constant Field Values

KEYBOARD_SUSPENDED

public static final int KEYBOARD_SUSPENDED
See Also:
Constant Field Values

CONTROLLERS_SUSPENDED

public static final int CONTROLLERS_SUSPENDED
See Also:
Constant Field Values
Constructor Detail

InputStatesManager

public InputStatesManager(InputBindingsManager<? extends InputAction> bindingsManager)
Creates a new InputStatesManager.

Parameters:
numActions - the number of available (bindeable) actions.
Method Detail

getInputStatesManipulator

public InputStatesManipulator getInputStatesManipulator()
Returns:
the InputStatesManipulator for this manager.

getKeyStatesManipulator

@Deprecated
public final InputStatesManipulator getKeyStatesManipulator()
Deprecated. renamed to getInputStatesManipulator()


setSuspendMask

public void setSuspendMask(int suspendMask)
Suspends or resumes this InputStatesManager.

Parameters:
suspendMask -
See Also:
MOUSE_AXES_SUSPENDED, MOUSE_BUTTONS_SUSPENDED, MOUSE_WHEEL_SUSPENDED, KEYBOARD_SUSPENDED, If an InputStatesManager is suspended, it will ignore any input.

getSuspendMask

public final int getSuspendMask()
Returns:
the suspendMask.
See Also:
MOUSE_AXES_SUSPENDED, MOUSE_BUTTONS_SUSPENDED, MOUSE_WHEEL_SUSPENDED, KEYBOARD_SUSPENDED, If an InputStatesManager is suspended, it will ignore any input.

getNumStates

public final int getNumStates()
Returns:
the number of key-states (or commands).

getInputState

public final InputState getInputState(InputAction action)
Parameters:
action -
Returns:
the current key-state for the given action.

getSimpleInputState

public final int getSimpleInputState(InputAction action)
Parameters:
action -
Returns:
the current key-state for the given action.

hasInputStateChanged

public final boolean hasInputStateChanged(InputAction action)
Parameters:
action -
Returns:
whether the state for the given action's state has changed.

update

public void update(long nanoTime)
Updates the key-states array.

Parameters:
nanoTime -

getActionsByState

public void getActionsByState(InputState state,
                              java.util.List<? super InputAction> actions,
                              boolean clearListBefore)
Fills all InputActions into the list, that currently have the requested InputState.

Parameters:
state -
actions -
clearListBefore -

getActionsByState

public final void getActionsByState(InputState state,
                                    java.util.List<? super InputAction> actions)
Fills all InputActions into the list, that currently have the requested InputState.
The list is cleared before.

Parameters:
state -
actions -

getActionsByState

public int getActionsByState(InputState state,
                             InputAction[] actions)
Fills all InputActions into the array, that currently have the requested InputState.
The array is not cleared before.
The array must be of sufficient length.
The number of found actions is returned.

Parameters:
state -
actions -
Returns:
the number of found actions.

getActionsByState

public InputAction[] getActionsByState(InputState state)
Fills all InputActions, that currently have the requested InputState, into an array.

Parameters:
state -
actions -
Returns:
an array of all found actions, or null, if no actions have been found.