Texture
Wrapper around a native texture data.
For more information about how to create meshes, have a look at the TextureManager class.
Note: Textures are per-engine, they can thus be shared by multiple scenes.
- Texture
.constructor(engine, param) ⇒ Texture- .height
- .htmlElement
.id.valid- .width
- .destroy() ⇒ void
- .toString() ⇒ string
- .update() ⇒ void
- .updateSubImage(x, y, w, h) ⇒ void
.constructor(engine: WonderlandEngine, param: number | ImageLike) ⇒ Texture
Deprecated: Use create instead, accessible via textures:
Param | Type | Description |
---|---|---|
engine | WonderlandEngine | |
param | number | ImageLike |
.height: number
Height of the texture.
.htmlElement: null | ImageLike
Returns the html element associated to this texture.
Note: This accessor will return null
if the image is compressed.
.id: number
Index in this manager.
Deprecated: Use index instead.
.valid: boolean
Whether this texture is valid
Deprecated: Use isDestroyed instead.
.width: number
Width of the texture.
.destroy() ⇒ void
0.9.0+Destroy and free the texture’s texture altas space and memory.
It is best practice to set the texture variable to null
after calling
destroy to prevent accidental use of the invalid texture:
.toString() ⇒ string
.update() ⇒ void
Update the texture to match the HTML element (e.g. reflect the current frame of a video).
.updateSubImage(x: number, y: number, w: number, h: number) ⇒ void
Update a subrange on the texture to match the HTML element (e.g. reflect the current frame of a video).
Usage:
Param | Type | Description |
---|---|---|
x | number | x offset |
y | number | y offset |
w | number | width |
h | number | height |