PIXI.Resource
class Resource
Base resource class for textures that manages validation and uploading, depending on its type.
Uploading of a base texture to the GPU is required.
Constructor
new PIXI.Resource(width: number, height: number) → {}
Name | Type | Default | Description |
---|---|---|---|
width | number | 0 |
Width of the resource |
height | number | 0 |
Height of the resource |
Summary
Properties from Resource
boolean |
|
number |
|
boolean |
|
string |
The url of the resource |
boolean |
|
number |
|
number |
Internal height of the resource. |
number |
Internal width of the resource. |
Methods from Resource
boolean |
|
void |
|
void |
|
void |
Clean up anything, this happens when destroying is ready. |
void |
|
boolean |
|
void |
|
void |
Has been updated trigger event. |
boolean |
|
Promise<PIXI.Resource> |
|
Public Properties
internal: boolean
true
if resource is created by BaseTexture
useful for doing cleanup with BaseTexture destroy
and not cleaning up resources that were created
externally.
Protected Properties
Public Methods
static test(_source: unknown, _extension: string) → {boolean}
Abstract, used to auto-detect resource type.
Name | Type | Attributes | Description |
---|---|---|---|
_source | unknown |
The source object |
|
_extension | string |
<optional> |
The extension of source, if set |
Type | Description |
---|---|
boolean |
bind(baseTexture: PIXI.BaseTexture) → {void}
Bind to a parent BaseTexture
Name | Type | Description |
---|---|---|
baseTexture | PIXI.BaseTexture |
Parent texture |
Type | Description |
---|---|
void |
destroy() → {void}
Call when destroying resource, unbind any BaseTexture object before calling this method, as reference counts are maintained internally.
Type | Description |
---|---|
void |
dispose() → {void}
Clean up anything, this happens when destroying is ready.
Type | Description |
---|---|
void |
resize(width: number, height: number) → {void}
Trigger a resize event
Name | Type | Description |
---|---|---|
width | number |
X dimension |
height | number |
Y dimension |
Type | Description |
---|---|
void |
style(_renderer: PIXI.Renderer, _baseTexture: PIXI.BaseTexture, _glTexture: PIXI.GLTexture) → {boolean}
Set the style, optional to override
Name | Type | Description |
---|---|---|
_renderer | PIXI.Renderer |
yeah, renderer! |
_baseTexture | PIXI.BaseTexture |
the texture |
_glTexture | PIXI.GLTexture |
texture instance for this webgl context |
Type | Description |
---|---|
boolean |
|
unbind(baseTexture: PIXI.BaseTexture) → {void}
Unbind to a parent BaseTexture
Name | Type | Description |
---|---|---|
baseTexture | PIXI.BaseTexture |
Parent texture |
Type | Description |
---|---|
void |
update() → {void}
Has been updated trigger event.
Type | Description |
---|---|
void |
upload(renderer: PIXI.Renderer, baseTexture: PIXI.BaseTexture, glTexture: PIXI.GLTexture) → {boolean}
Uploads the texture or returns false if it cant for some reason. Override this.
Name | Type | Description |
---|---|---|
renderer | PIXI.Renderer |
yeah, renderer! |
baseTexture | PIXI.BaseTexture |
the texture |
glTexture | PIXI.GLTexture |
texture instance for this webgl context |
Type | Description |
---|---|
boolean |
|
Protected Methods
protected load() → {Promise<PIXI.Resource>}
This can be overridden to start preloading a resource or do any other prepare step.
Type | Description |
---|---|
Promise<PIXI.Resource> |
Handle the validate event |