Text added to PIXI
destroy function added to textures too docs updated new example added
This commit is contained in:
parent
7933cadb77
commit
09dbbd5d13
66 changed files with 10970 additions and 681 deletions
|
@ -67,6 +67,8 @@
|
|||
|
||||
<li><a href="../classes/Stage.html">Stage</a></li>
|
||||
|
||||
<li><a href="../classes/Text.html">Text</a></li>
|
||||
|
||||
<li><a href="../classes/Texture.html">Texture</a></li>
|
||||
|
||||
<li><a href="../classes/TilingSprite.html">TilingSprite</a></li>
|
||||
|
@ -126,6 +128,7 @@
|
|||
|
||||
PIXI.BaseTextureCache = {};
|
||||
PIXI.texturesToUpdate = [];
|
||||
PIXI.texturesToDestroy = [];
|
||||
|
||||
/**
|
||||
* A texture stores the information that represents an image. All textures have a base texture
|
||||
|
@ -208,9 +211,43 @@ PIXI.BaseTexture = function(source)
|
|||
|
||||
PIXI.BaseTexture.constructor = PIXI.BaseTexture;
|
||||
|
||||
PIXI.BaseTexture.prototype.fromImage = function(imageUrl)
|
||||
PIXI.BaseTexture.prototype.destroy = function()
|
||||
{
|
||||
|
||||
if(this.source instanceof Image)
|
||||
{
|
||||
this.source.src = null;
|
||||
}
|
||||
this.source = null;
|
||||
PIXI.texturesToDestroy.push(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Helper function that returns a base texture based on an image url
|
||||
* If the image is not in the base texture cache it will be created and loaded
|
||||
* @static
|
||||
* @method fromImage
|
||||
* @param imageUrl {String} The image url of the texture
|
||||
* @return BaseTexture
|
||||
*/
|
||||
PIXI.BaseTexture.fromImage = function(imageUrl, crossorigin)
|
||||
{
|
||||
var baseTexture = PIXI.BaseTextureCache[imageUrl];
|
||||
if(!baseTexture)
|
||||
{
|
||||
var image = new Image();
|
||||
if (crossorigin)
|
||||
{
|
||||
image.crossOrigin = '';
|
||||
}
|
||||
image.src = imageUrl;
|
||||
baseTexture = new PIXI.BaseTexture(image);
|
||||
PIXI.BaseTextureCache[imageUrl] = baseTexture;
|
||||
}
|
||||
|
||||
return baseTexture;
|
||||
}
|
||||
|
||||
</pre>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue