dino-ge
    Preparing search index...

    Class default

    The core singleton class that manages the game loop, rendering, and scene state.

    Index

    Constructors

    Properties

    backgroundColour: string

    Current background colour.

    callbacks: EngineCallbacks

    Registered engine callbacks.

    fps: number = 0

    Current frames per second (rolling average).

    frameTime: number = 0

    Current frame time in milliseconds.

    height: number

    Pixel height of the canvas.

    width: number

    Pixel width of the canvas.

    Accessors

    • set cursor(value: string): void

      Sets the CSS cursor style for the game canvas.

      Parameters

      • value: string

        The CSS cursor value (e.g., 'pointer', 'crosshair').

      Returns void

    Methods

    • Starts a countdown timer that runs a function every second and an ending function.

      Parameters

      • milliseconds: number

        The total duration of the countdown.

      • fn: () => void

        The function to run every second.

      • onEnded: () => void

        The function to run when the countdown is finished.

      Returns void

    • Schedules a function to run after a delay.

      Parameters

      • callback: () => void

        The function to run.

      • delay: number

        The delay in milliseconds.

      Returns number

      A timer ID.

    • Emits a custom event on the global engine bus.

      Parameters

      • type: string

        The event type.

      • Optionaldetail: unknown

        Optional data to pass with the event.

      Returns void

    • Stops listening for an event on the global engine bus.

      Parameters

      • type: string

        The event type.

      • callback: (event: CustomEvent) => void

        The function to remove.

      Returns void

    • Listens for an event on the global engine bus.

      Parameters

      • type: string

        The event type (e.g., 'paused', 'PLAYER_DIED').

      • callback: (event: CustomEvent) => void

        The function to run when the event occurs.

      Returns void