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 TypeMethodDescriptionbooleanisKeyHeld(int keyCode) Checks if a key is held based on its keycode.booleanChecks if aKeyis held.booleanisKeyPressed(int keyCode) Checks if a key is pressed based on its keycode.booleanisKeyPressed(Key key) Checks if aKeyis pressed.voidkeyReleased(KeyEvent keyEvent) Called on release of a key.voidonKeyPressed(KeyEvent keyEvent) Called on press of a key.voidCalled 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 the key is pressed
-
isKeyPressed
Checks if aKeyis pressed.- Parameters:
key- the key to check- Returns:
- true if the 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 the key is held
-
isKeyHeld
Checks if aKeyis held.- Parameters:
key- the key to check- Returns:
- true if the 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
-