Class Input

Represents the Input class.

Constructors

Properties

game: Game

The game instance.

keyboardData: Record<string, number> = {}

The keyboard data.

mouseScreenPos: Vector = ...

The mouse screen position.

mouseWheel: number = 0

The mouse wheel value.

pointerData: Record<number, number> = {}

The pointer data.

Methods

  • Checks if a key is currently down.

    Parameters

    • key: string

      The key to check.

    Returns number

    1 if the key is down, otherwise 0.

  • Checks if a key was pressed.

    Parameters

    • key: string

      The key to check.

    Returns 0 | 1

    1 if the key was pressed, otherwise 0.

  • Checks if a key was released.

    Parameters

    • key: string

      The key to check.

    Returns 0 | 1

    1 if the key was released, otherwise 0.

  • Checks if a mouse button is currently down.

    Parameters

    • button: number

      The button to check.

    Returns number

    1 if the button is down, otherwise 0.

  • Checks if a mouse button was pressed.

    Parameters

    • button: number

      The button to check.

    Returns 0 | 1

    1 if the button was pressed, otherwise 0.

  • Checks if a mouse button was released.

    Parameters

    • button: number

      The button to check.

    Returns 0 | 1

    1 if the button was released, otherwise 0.