omega-game-engine
    Preparing search index...

    Class Mouse

    A static class for managing mouse input state.

    • It tracks button presses, cursor position, and movement deltas.
    Index

    Constructors

    Properties

    mouseButtonDown: { [key: string]: boolean } = {}

    A map that stores the pressed state of each mouse button.

    • true if the button is currently held down, false otherwise.

    mouseClickPosition: { x: number; y: number } = ...

    The position of the mouse cursor when a button was last pressed.

    mouseMovement: { x: number; y: number } = ...

    The movement delta of the mouse since the last frame.

    mousePosition: { x: number; y: number } = ...

    The current position of the mouse cursor relative to the viewport.

    wheelX: number = 0

    The movement delta of the mouse weel y since the last frame.

    wheelY: number = 0

    The movement delta of the mouse weel x since the last frame.

    Methods

    • Gets the mouse movement delta since the last frame.

      Returns { x: number; y: number }

      An object with x and y movement deltas.

    • Gets the current mouse position relative to the canvas.

      Returns { x: number; y: number }

      An object with x and y coordinates.

    • Gets the mouse wheel scroll delta since the last frame.

      Returns { x: number; y: number }

      An object with x and y scroll deltas.

    • Checks if a specific mouse button is currently held down.

      Parameters

      • button: number

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

      Returns boolean

      True if the button is down, false otherwise.