Class Input

java.lang.Object
util.Input

public class Input extends Object
Handles keyboard input for the game.

Tracks which keys are currently held, pressed this frame, or released this frame.

  • Field Details

  • 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

      public static boolean isHeld(String key)
      Checks if the specified key is currently held down.
      Parameters:
      key - the key name
      Returns:
      true if the key is being held down
    • isPressed

      public static boolean isPressed(String key)
      Checks if the specified key was pressed this frame.
      Parameters:
      key - the key name
      Returns:
      true if the key was pressed this frame
    • isReleased

      public static boolean isReleased(String key)
      Checks if the specified key was released this frame.
      Parameters:
      key - the key name
      Returns:
      true if the key was released this frame