mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +00:00
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:
parent
d6c0942e20
commit
cf363a56f1
2 changed files with 13 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue