mwg API
    Preparing search index...

    Interface GameOptions

    interface GameOptions {
        background?: number;
        canvas?: HTMLCanvasElement;
        extensions?: readonly (() => void)[];
        maxDelta?: number;
        pixelArt?: boolean;
        resizeTo?: Window | HTMLElement;
    }
    Index
    background?: number

    background colour behind everything, as 0xRRGGBB

    canvas?: HTMLCanvasElement

    the canvas to draw into; one is created and appended if omitted

    extensions?: readonly (() => void)[]

    Pixi extension registrations to run before the renderer is built.

    TintedSprite (and everything built on it - AnimatedSprite, TileMap, DialogueStage) registers its own colour-transform pipe automatically, at module scope, the moment a game imports it; a game never has to pass anything here for that. TiledSprite and NinePatch carry the same guarantee through a different mechanism: Pixi's own TilingSprite/NineSliceSprite modules each side-effect-import their own init module, which registers their render pipe unconditionally the moment the class is imported - true of Pixi's package itself, not something mwg implements or could accidentally omit, and confirmed directly against Pixi's own source rather than assumed (tests/builtin-pipes.test.ts checks it stays true). This stays as an escape hatch for a game defining its own Pixi extension - a custom render pipe, its own batcher - which still has to be registered before app.init() builds the renderer, the same constraint registerColorTransform works around by self-registering on import instead of needing a caller to remember it.

    maxDelta?: number

    Longest frame the game will simulate, in seconds.

    A backgrounded tab reports an enormous delta on its first frame back, which would teleport everything that moves. Frames longer than this are treated as this long, so the game slows down rather than jumping.

    pixelArt?: boolean

    Pixel art is never smoothed when scaled - both inside the game (texture sampling) and in the browser's own compositing of the canvas element onto the page, which is a separate step and blurs on its own if left at the default. Set false for a game whose art is not pixel art and should smooth when magnified.

    resizeTo?: Window | HTMLElement

    What the renderer sizes itself to. Defaults to the window.

    Sizing to the canvas's parent looks tidier but circles: a canvas styled to fill its parent gives the parent no height of its own, so both collapse. Pass an element only when that element has a size the canvas does not depend on.