Class Input
java.lang.Object
util.Input
Handles keyboard input for the game.
Tracks which keys are currently held, pressed this frame, or released this frame.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidattach(javafx.scene.Scene scene) Attaches keyboard listeners to the given scene.static voidInitializes the input system (currently empty placeholder).static booleanChecks if the specified key is currently held down.static booleanChecks if the specified key was pressed this frame.static booleanisReleased(String key) Checks if the specified key was released this frame.static voidupdate()Updates the input system, clearing pressed and released keys.
-
Field Details
-
keys
-
pressed
-
released
-
-
Constructor Details
-
Input
public Input()
-
-
Method Details
-
initialize
public static void initialize()Initializes the input system (currently empty placeholder). -
attach
public static void attach(javafx.scene.Scene scene) Attaches keyboard listeners to the given scene.- Parameters:
scene- the JavaFX scene to attach key listeners to
-
update
public static void update()Updates the input system, clearing pressed and released keys. -
isHeld
Checks if the specified key is currently held down.- Parameters:
key- the key name- Returns:
- true if the key is being held down
-
isPressed
Checks if the specified key was pressed this frame.- Parameters:
key- the key name- Returns:
- true if the key was pressed this frame
-
isReleased
Checks if the specified key was released this frame.- Parameters:
key- the key name- Returns:
- true if the key was released this frame
-