Interface Game

Definition of a game that will use this graphics context. Events are provided by the library and a call back for the render loop.

interface Game {
    keyDown(key): void;
    keyUp(key): void;
    mouseDown(x, y, index): void;
    mouseDrag(x, y, index): void;
    mouseUp(x, y, index): void;
    render(): void;
    resourcesLoaded(): void;
    zoomChanged?(delta): void;
}

Hierarchy (view full)

Methods

  • Notification that a key has been pressed on the keyboard

    Parameters

    • key: string

      The name of the key pressed

    Returns void

  • Notification that a key has been released on the keyboard

    Parameters

    • key: string

      The name of the key released

    Returns void

  • Notification that the mouse has been pressed or the a finger has been touched

    Parameters

    • x: number

      The x coordinate of the touch/press

    • y: number

      The y coordinate of the touch/press

    • index: number

      The mouse button or finger that was used to make the touch/press

    Returns void

  • Notification tat the mouse has been dragged or the a finger has been moved

    Parameters

    • x: number

      The x coordinate of the touch/drag

    • y: number

      The y coordinate of the touch/drag

    • index: number

      The mouse button or finger that was used to make the touch/drag

    Returns void

  • Notification that the mouse has been released or the a finger has been lifted

    Parameters

    • x: number

      The x coordinate of the touch/release

    • y: number

      The y coordinate of the touch/release

    • index: number

      The mouse button or finger that was used to make the touch/release

    Returns void

  • Callback for the render loop. It's important to only render to the main context in this method so the underlying renderer can make assumptions about the graphics being used.

    Returns void

  • Parameters

    • delta: number

    Returns void

Generated using TypeDoc