Interface EngineOptions

Options available to the Engine class.

interface EngineOptions {
    container?: string;
    framerate?: null | number;
    fullscreen?: boolean;
    height?: number;
    hooks?: {
        afterStep: (() => Promise<void>);
        beforeStep: (() => Promise<void>);
    };
    resolution?: number;
    width?: number;
}

Properties

container?: string

A DOMString to the container of the engine's canvas.

'body'
framerate?: null | number

If set, gives a maximum framerate for the engine's fixed update loop.

null
fullscreen?: boolean

If true, sets the width and height of the engine's canvas to follow the container's size.

true
height?: number

Height of the engine's canvas.

720
hooks?: {
    afterStep: (() => Promise<void>);
    beforeStep: (() => Promise<void>);
}

Hooks are functions that are called at specific points in the engine's runtime.

Type declaration

  • afterStep: (() => Promise<void>)

    Called after the engine's step loop.

    async () => { }
    
      • (): Promise<void>
      • Returns Promise<void>

  • beforeStep: (() => Promise<void>)

    Called before the engine's step loop.

    async () => { }
    
      • (): Promise<void>
      • Returns Promise<void>

resolution?: number

Resolution used by the engine's canvas.

true
width?: number

Width of the engine's canvas.

1280