TextureManager

Manage textures.

This manager is accessible on the engine instance using textures.

Usage:

1this.engine.load('path/to/texture.png').then((texture) => {
2    console.log('Loaded!');
3    console.log(texture);
4})

.allocatedCount: number 

Number of textures allocated in the manager.

.count: number 

Number of textures in the manager.

Note: For performance reasons, avoid calling this method when possible.

.get(id: number) ⇒ null | Texture 

Retrieve the texture with the given id.

Returns: The Texture if found, null otherwise.

ParamTypeDescription
idnumberThe texture identifier.

.load(filename: string, crossOrigin: string) ⇒ Promise<Texture

Load an image from URL as Texture.

Returns: Loaded texture.

ParamTypeDescription
filenamestringURL to load from.
crossOriginstringCross origin flag for the image object.

.wrap(id: number) ⇒ Texture 

Wrap a texture ID using Texture.

Note: This method performs caching and will return the same instance on subsequent calls.

Returns: The texture.

ParamTypeDescription
idnumberID of the texture to create.