ecspresso
    Preparing search index...

    Type Alias Renderer2DPluginOptions<G>

    Renderer2DPluginOptions:
        | Renderer2DPluginAppOptions<G>
        | Renderer2DPluginManagedOptions<G>

    Configuration options for the 2D renderer plugin.

    Supports two modes:

    1. Pre-initialized: Pass an already-initialized Application via app
    2. Managed: Omit app and the plugin creates the Application during ecs.initialize(). The canvas is appended to container (defaults to document.body) and auto-resizes to match it. Pass pixiInit: { width, height } for a fixed-size canvas instead.

    This plugin includes transform propagation automatically - no need to add createTransformPlugin() separately.

    Type Parameters

    • G extends string = "renderer2d"
    const app = new Application();
    await app.init({ resizeTo: window });
    const ecs = ECSpresso.create()
    .withPlugin(createRenderer2DPlugin({ app }))
    .withComponentTypes<{ player: true }>()
    .build();
    const ecs = ECSpresso.create()
    .withPlugin(createRenderer2DPlugin({
    background: '#1099bb',
    }))
    .withComponentTypes<{ player: true }>()
    .build();
    await ecs.initialize(); // Application created here