Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## simogl.input
Class InputAction

    java.lang.Object
      simogl.input.InputAction

    public class InputAction

extends java.lang.Object

This class represents an input action of the application. It can be used to determine whether an input key was pressed or mouse movement occured.
Note: This class was strongly inspired by the book "Developing Games In Java" by David Brackeen

Author:
  Frank Bruns

Field Summary
`static int` | `DETECT_INITAL_PRESS_ONLY` This state is used, to represent that only the first KeyEvent shall be considered, if a key is held down and hence a sequence of KeyEvent would be produced.
`static int` | `NORMAL` This state is used, to signal that every produced KeyEvent shall be considered.

Constructor Summary
`InputAction(java.lang.String name)` Create a new InputAction using the NORMAL state
`InputAction(java.lang.String name, int behavior)` Create a new InputAction with the specified behavior state constant.

Method Summary
`int` | `getAmount()` Returns either the number of times the input action's key was pressed or the distance the mouse has been moved
`java.lang.String` | `getName()` Returns the name of this InputAction.
`boolean` | `isPressed()` Returns whether the input action's key was pressed or not since last checked.
`void` | `press()` Pretends that the key assigned to this input action was pressed once.
`void` | `press(int amount)` Pretends that the key assigned to this input action was pressed the specified amount of times or that the mouse was moved a dinstance according to the specified amount
`void` | `release()` Signals that the key assigned to this input action was released
`void` | `reset()` Resets the input action.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NORMAL

    public static final int NORMAL

  This state is used, to signal that every produced KeyEvent shall be considered. If a key is held down the whole sequence of KeyEvents will be processed.

  See Also:
    Constant Field Values

### DETECT_INITAL_PRESS_ONLY

    public static final int DETECT_INITAL_PRESS_ONLY

  This state is used, to represent that only the first KeyEvent shall be considered, if a key is held down and hence a sequence of KeyEvent would be produced.

  See Also:
    Constant Field Values

Constructor Detail

### InputAction

    public InputAction(java.lang.String name)

  Create a new InputAction using the NORMAL state

  Parameters:
    `name` - name of the input action

### InputAction

    public InputAction(java.lang.String name,
                       int behavior)

  Create a new InputAction with the specified behavior state constant.

  Parameters:
    `name` - name of the input action
    `behavior` - InputAction.NORMAL or InputAction.DETECT_INITAL_PRESS_ONLY

Method Detail

### getName

    public java.lang.String getName()

  Returns the name of this InputAction.

### reset

    public void reset()

  Resets the input action. The effect of this is, that the input action appears to was never pressed

### press

    public void press()

  Pretends that the key assigned to this input action was pressed once.

### press

    public void press(int amount)

  Pretends that the key assigned to this input action was pressed the specified amount of times or that the mouse was moved a dinstance according to the specified amount

  Parameters:
    `amount` - pretended amount of key presses or mouse move distances

### release

    public void release()

  Signals that the key assigned to this input action was released

### isPressed

    public boolean isPressed()

  Returns whether the input action's key was pressed or not since last checked.

### getAmount

    public int getAmount()

  Returns either the number of times the input action's key was pressed or the distance the mouse has been moved

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD