java.lang.Object
technology.sola.engine.input.KeyboardInput
KeyboardInput contains information about user interaction with the keyboard.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a KeyboardInput instance initializing the state of all keys to be released. -
Method Summary
Modifier and TypeMethodDescriptionboolean
isKeyHeld
(int keyCode) Checks if a key is held based on its keycode.boolean
Checks if aKey
is held.boolean
isKeyPressed
(int keyCode) Checks if a key is pressed based on its keycode.boolean
isKeyPressed
(Key key) Checks if aKey
is pressed.void
keyReleased
(KeyEvent keyEvent) Called on release of a key.void
onKeyPressed
(KeyEvent keyEvent) Called on press of a key.void
Called once per frame to update the current status of the keyboard based on the user's interaction.
-
Constructor Details
-
KeyboardInput
public KeyboardInput()Creates a KeyboardInput instance initializing the state of all keys to be released.
-
-
Method Details
-
isKeyPressed
public boolean isKeyPressed(int keyCode) Checks if a key is pressed based on its keycode.- Parameters:
keyCode
- the code of the key to check- Returns:
- true if key is pressed
-
isKeyPressed
Checks if aKey
is pressed.- Parameters:
key
- the key to check- Returns:
- true if key is pressed
-
isKeyHeld
public boolean isKeyHeld(int keyCode) Checks if a key is held based on its keycode.- Parameters:
keyCode
- the code of the key to check- Returns:
- true if key is held
-
isKeyHeld
Checks if aKey
is held.- Parameters:
key
- the key to check- Returns:
- true if key is held
-
updateStatusOfKeys
public void updateStatusOfKeys()Called once per frame to update the current status of the keyboard based on the user's interaction. -
onKeyPressed
Called on press of a key.- Parameters:
keyEvent
- theKeyEvent
-
keyReleased
Called on release of a key.- Parameters:
keyEvent
- theKeyEvent
-