Constructors

Methods

  • Gets the time (in milliseconds) since a specific key was pressed.

    Parameters

    • key: string

      The key to check.

    Returns number

    The time since the key was pressed, or 0 if the key is not currently pressed.

  • Gets the time (in milliseconds) since a specific mouse button was pressed.

    Parameters

    • button: number

      The mouse button to check (0 for left, 1 for middle, 2 for right).

    Returns number

    The time since the mouse button was pressed, or 0 if the button is not currently pressed.

  • Gets the current mouse X coordinate.

    Returns number

    The mouse X coordinate.

  • Gets the current mouse Y coordinate.

    Returns number

    The mouse Y coordinate.

  • Checks if a specific key is currently pressed.

    Parameters

    • key: string

      The key to check (e.g., "a", "ArrowUp", " ").

    Returns boolean

    True if the key is pressed, false otherwise.

  • Checks if a specific mouse button is currently pressed.

    Parameters

    • button: number

      The mouse button to check (0 for left, 1 for middle, 2 for right).

    Returns boolean

    True if the button is pressed, false otherwise.

  • Adds an event listener for a specific key.

    Parameters

    • key: string

      The key to listen for (e.g., "a", "ArrowUp", " ").

    • listener: (() => void)

      The function to call when the key is pressed.

        • (): void
        • Returns void

    Returns this

    The Input instance for chaining.