Class KeyBindings<Action extends Enum<Action>>
java.lang.Object
dev.prozilla.pine.core.state.input.KeyBindings<Action>
- Type Parameters:
Action
- Enum of actions
Handles key bindings for the input system.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Binds a key to an action.void
Binds multiple keys to a single action.getActionKey
(Action action) Returns the key bound to a given action.Key[]
getActionKeys
(Action action) Returns the keys bound to a given action.boolean
Checks whether the key(s) bound to a given action are pressed.void
Prints all key bindings.void
removeAction
(Action action) Unbinds the keys for a given action.
-
Constructor Details
-
KeyBindings
Creates new key bindings.- Parameters:
input
- Reference to input system
-
-
Method Details
-
addAction
Binds a key to an action.- Parameters:
action
- Actionkey
- Key
-
addAction
Binds multiple keys to a single action.- Parameters:
action
- Actionkeys
- Key
-
removeAction
Unbinds the keys for a given action.- Parameters:
action
- Action
-
getActionKey
Returns the key bound to a given action.- Parameters:
action
- Action- Returns:
- Key
-
getActionKeys
Returns the keys bound to a given action.- Parameters:
action
- Action- Returns:
- Keys
-
isActive
Checks whether the key(s) bound to a given action are pressed.- Parameters:
action
- Action- Returns:
- True if any key bound to the action is pressed
-
print
Prints all key bindings.
-