Cache.removeImage has a new parameter: removeFromPixi which is true by default. It will remove the image from the Pixi BaseTextureCache as well as from the Phaser Cache. Set to false if you don't want the Pixi cache touched.

This commit is contained in:
Richard Davey 2014-09-16 12:20:03 +01:00
parent d6c0942e20
commit cf363a56f1
2 changed files with 13 additions and 2 deletions

View file

@ -76,6 +76,7 @@ Version 2.1.2 - "Whitebridge" - in development
### New Features
* StateManager.unlink will null all State-level Phaser properties, such as `game`, `add`, etc. Useful if you never need to return to the State again.
* Cache.removeImage has a new parameter: `removeFromPixi` which is `true` by default. It will remove the image from the Pixi BaseTextureCache as well as from the Phaser Cache. Set to false if you don't want the Pixi cache touched.
### Updates

View file

@ -1215,13 +1215,23 @@ Phaser.Cache.prototype = {
},
/**
* Removes an image from the cache.
* Removes an image from the cache and optionally from the Pixi.BaseTextureCache as well.
*
* @method Phaser.Cache#removeImage
* @param {string} key - Key of the asset you want to remove.
* @param {boolean} [removeFromPixi=true] - Should this image also be removed from the Pixi BaseTextureCache?
*/
removeImage: function (key) {
removeImage: function (key, removeFromPixi) {
if (typeof removeFromPixi === 'undefined') { removeFromPixi = true; }
delete this._images[key];
if (removeFromPixi)
{
PIXI.BaseTextureCache[key].destroy();
}
},
/**