Class TextureManager
Defined in: TextureManager.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Singleton managing texture image cache.
|
Method Attributes | Method Name and Description |
---|---|
clear()
Clears loaded texture images cache.
|
|
<static> |
TextureManager.getInstance()
Returns an instance of this singleton.
|
getRotatedTextureHeight(texture)
Returns the height of the given texture once its rotation angle is applied.
|
|
getRotatedTextureWidth(texture)
Returns the width of the given texture once its rotation angle is applied.
|
|
isTextureTransparent(textureImage)
Returns
true if the texture is shared and its image contains
at least one transparent pixel. |
|
loadTexture(content, angle, synchronous, textureObserver)
Reads a texture image from
content notified to textureObserver . |
Method Detail
clear()
Clears loaded texture images cache.
<static>
{TextureManager}
TextureManager.getInstance()
Returns an instance of this singleton.
- Returns:
- {TextureManager}
{number}
getRotatedTextureHeight(texture)
Returns the height of the given texture once its rotation angle is applied.
- Parameters:
- texture
- Returns:
- {number}
{number}
getRotatedTextureWidth(texture)
Returns the width of the given texture once its rotation angle is applied.
- Parameters:
- texture
- Returns:
- {number}
{boolean}
isTextureTransparent(textureImage)
Returns
true
if the texture is shared and its image contains
at least one transparent pixel.
- Parameters:
- textureImage
- Returns:
- {boolean}
loadTexture(content, angle, synchronous, textureObserver)
Reads a texture image from
content
notified to textureObserver
.
If the texture isn't loaded in cache yet and synchronous
is false, a one pixel
white image texture will be notified immediately to the given textureObserver
,
then a second notification will be given in Event Dispatch Thread once the image texture is loaded.
If the texture is in cache, it will be notified immediately to the given textureObserver
.
- Parameters:
- {URLContent} content
- an object containing an image
- {number} angle Optional
- the rotation angle applied to the image
- {boolean} synchronous Optional
- if
true
, this method will return only once image content is loaded. - {{textureUpdated|textureError|progression}} textureObserver
- the observer that will be notified once the texture is available.
It may define
textureUpdated(textureImage)
,textureError(error)
,progression(part, info, percentage)
optional methods withtextureImage
being an instance of
Image
,error
,part
,info
strings andpercentage
a number.