new PrepareSystem () overrides
Example
import 'pixi.js/prepare';
import { Application, Graphics } from 'pixi.js';
// Create a new application (prepare will be auto-added to renderer)
const app = new Application();
await app.init();
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();
});
Extends
Implements
Methods
Destroys the plugin, don't use after this.
Inherited Properties
From class PrepareBase
queue PrepareQueueItem[] protected inherited
The queue to process over a async timer
Reference to the renderer
resolves ((value: void | PromiseLike<void>) => void)[] protected inherited
Collection of callbacks to call when the uploads are finished
timeout number protected inherited
Timeout id for next processing call
Inherited Methods
From class PrepareUpload
Resolve the given graphics context and return an item for the queue
Name | Type | Description |
---|---|---|
graphicsContext |
GraphicsContext |
Upload the given queue item
Name | Type | Description |
---|---|---|
item |
PrepareQueueItem |
From class PrepareQueue
Resolve the given container and return an item for the queue
Name | Type | Description |
---|---|---|
container |
Container | |
queue |
PrepareQueueItem[] |
resolveGraphicsContextQueueItem (graphicsContext) PrepareQueueItem | null protected inherited
Resolve the given graphics context and return an item for the queue
Name | Type | Description |
---|---|---|
graphicsContext |
GraphicsContext |
Returns:
Type | Description |
---|---|
PrepareQueueItem | null |
Resolve the given resource type and return an item for the queue
Name | Type | Description |
---|---|---|
source |
PrepareSourceItem | |
queue |
PrepareQueueItem[] |
From class PrepareBase
Add a textures or graphics resource to the queue
Name | Type | Description |
---|---|---|
resource |
PrepareSourceItem | PrepareSourceItem<Array> |
Returns:
Type | Description |
---|---|
this |
eliminate duplicates before processing
getQueue () Array<PrepareQueueItem> inherited
Return a copy of the queue
Returns:
Type | Description |
---|---|
Array<PrepareQueueItem> | The queue |
Upload all the textures and graphics to the GPU (optionally add more resources to the queue first)
Name | Type | Attributes | Description |
---|---|---|---|
resource |
PrepareSourceItem | PrepareSourceItem<Array> | unknown |
<optional> |
Returns:
Type | Description |
---|---|
Promise<void> |