Initializes the Input class by attaching event listeners for keyboard and mouse events.
Gets the time (in milliseconds) since a specific key was pressed.
The key to check.
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.
The mouse button to check (0 for left, 1 for middle, 2 for right).
The time since the mouse button was pressed, or 0 if the button is not currently pressed.
Gets the current mouse X coordinate.
The mouse X coordinate.
Gets the current mouse Y coordinate.
The mouse Y coordinate.
Checks if a specific key is currently pressed.
The key to check (e.g., "a", "ArrowUp", " ").
True if the key is pressed, false otherwise.
Checks if a specific mouse button is currently pressed.
True if the button is pressed, false otherwise.
Adds an event listener for a specific key.
The key to listen for (e.g., "a", "ArrowUp", " ").
The function to call when the key is pressed.
The Input instance for chaining.
Initializes the Input class by attaching event listeners for keyboard and mouse events.