public class Control
extends Object
A class to handle user's input.
-
Field Summary
Fields
private int[]
The list of all input keys.
-
Constructor Summary
Constructors
Creates a new keybinding for some action.
-
Method Summary
boolean
Checks if any of the
keys
is pressed down.
boolean
Checks if any of the
keys
is pressed and released.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
keys
private int[] keys
The list of all input keys.
-
Constructor Details
-
Control
public Control(int... keys)
Creates a new keybinding for some action.
- Parameters:
keys
- the arbitrary list of input keys
-
Method Details
-
down
public boolean down()
Checks if any of the
keys
is pressed down.
- Returns:
- if any of the
keys
is pressed down
-
pressed
public boolean pressed()
Checks if any of the
keys
is pressed and released.
- Returns:
- if any of the
keys
is pressed and released