dacha
    Preparing search index...

    Class PixiView

    PixiView component for rendering a view.

    Handles the visual representation of an actor using a custom pixi.js view. It gives more control over the rendering of the actor and allows to use pixi.js features that are not supported by other components.

    // Create a pixi view
    const pixiView = new PixiView({
    createView: () => {
    const graphics = new Graphics()
    .rect(0, 0, 100, 100)
    .fill({ color: 0x000000 })
    .circle(0, 0, 50)
    .stroke({ color: 0x000000, width: 2 });
    return graphics;
    },
    sortingLayer: 'units',
    sortOffset: { x: 0, y: 0 },
    });

    // Add to actor
    actor.setComponent(pixiView);

    Hierarchy (View Summary)

    Index
    • Creates a new PixiView component.

      Parameters

      • config: PixiViewConfig

        Configuration for the pixi view

      Returns PixiView

    actor?: Actor
    createView?: () => ViewContainer

    Function to create a custom pixi.js view

    renderData?: RenderData

    Internal rendering data

    sortingLayer: string

    Sorting layer of the pixi view

    sortOffset: Point

    Center point of the pixi view

    componentName: string
    • get view(): ViewContainer<any> | undefined

      Get the pixi.js view. It's only available after the actor with this component is added to a scene

      Returns ViewContainer<any> | undefined