gameforge - v0.1.12
    Preparing search index...

    Class Prepare

    The prepare plugin provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for asynchronously preparing and uploading to the GPU assets, textures, graphics waiting to be displayed.

    Do not instantiate this plugin directly. It is available from the renderer.prepare property.

    import { Application, Graphics } from 'pixi.js';

    // Create a new application (prepare will be auto-added to renderer)
    const app = new Application();
    document.body.appendChild(app.view);

    // Don't start rendering right away
    app.stop();

    // Create a display object
    const rect = new Graphics()
    .beginFill(0x00ff00)
    .drawRect(40, 40, 200, 200);

    // Add to the stage
    app.stage.addChild(rect);

    // Don't start rendering until the graphic is uploaded to the GPU
    app.renderer.prepare.upload(app.stage, () => {
    app.start();
    });

    PIXI

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    addHooks: any[]

    Collection of additional hooks for finding assets.

    completes: any[]

    Callback to call after completed.

    queue: any[]

    Collection of items to uploads at once.

    renderer: IRenderer

    Reference to the renderer.

    ticking: boolean

    If prepare is ticking (running).

    uploadHookHelper: any

    The only real difference between CanvasPrepare and Prepare is what they pass to upload hooks. That different parameter is stored here.

    uploadHooks: any[]

    Collection of additional hooks for processing assets.

    uploadsPerFrame: number

    The default maximum uploads per frame.

    Methods

    • Destroys the plugin, don't use after this.

      Returns void

    • Adds hooks for finding items.

      Parameters

      • addHook: IFindHook

        Function call that takes two parameters: item:*, queue:Array function must return true if it was able to add item to the queue.

      Returns this

      Instance of plugin for chaining.

    • Adds hooks for uploading items.

      Parameters

      • uploadHook: IUploadHook

        Function call that takes two parameters: prepare:CanvasPrepare, item:* and function must return true if it was able to handle upload of item.

      Returns this

      Instance of plugin for chaining.