Class: Gfx2TextureManager
The `Gfx2TextureManager` class is a singleton responsible for managing, loading, caching, and deleting
textures represented as `ImageBitmap` objects.
Constructors
- new Gfx2TextureManager(): Gfx2TextureManager
The constructor.
Methods
- deleteTexture(path: string): void
The "deleteTexture" function deletes a texture if it exists, otherwise it throws an error.
- path: The path to the texture file.
- getTexture(path: string): ImageBitmap
The "getTexture" function returns an `ImageBitmap` object for a given texture path, or throws an
error if the texture doesn't exist.
- path: The path to the texture file.
- hasTexture(path: string): boolean
The "hasTexture" function checks if a texture exists in the manager.
- path: The path of the texture file.
- loadTexture(path: string): Promise
The "loadTexture" function asynchronously loads an image from a given path and returns it as an
`ImageBitmap`, caching it for future use.
- path: The file path or URL of the image that you want to load as a texture.
- releaseTextures(): void
The "releaseTextures" function deletes all the textures stored in the manager.