mirror of
https://github.com/photonstorm/phaser
synced 2024-11-21 20:23:19 +00:00
TileSprite textures are now stored in the TextureManager
This commit is contained in:
parent
6ea40f8b32
commit
1bfdcfe922
2 changed files with 19 additions and 3 deletions
|
@ -9,7 +9,7 @@
|
|||
* The `TweenChainBuilder` was incorrectly setting the `persist` flag on the Chain to `true`, which goes against what the documentation says. It now correctly sets it to `false`. This means if you previously had a Tween Chain that was persisting, it will no longer do so, so add the property to regain the feature.
|
||||
* The `dropped` argument has now been adeded to the documentation for the `DRAG_END` and `GAMEOBJECT_DRAG_END` events (thanks @samme)
|
||||
* `Container.onChildDestroyed` is a new internal method used to destroy Container children. Previously, if you destroyed a Game Object in an exclusive Container, the game object would (momentarily) move onto the Scene display list and emit an ADDED_TO_SCENE event. Also, if you added a Sprite to a non-exclusive Container and stopped the Scene, you would get a TypeError (evaluating 'this.anims.destroy'). This happened because the fromChild argument in the DESTROY event was misinterpreted as destroyChild in the Container's remove(), and the Container was calling the Sprite's destroy() again. (thanks @samme)
|
||||
* The `Text` Game Object now places its texture into the global `TextureManager` and a `_textureKey` private string property has been added to reference that texture.
|
||||
* The `Text` and `TileSprite` Game Objects now place their textures into the global `TextureManager` and a `_textureKey` private string property has been added which contains a UUID to reference that texture.
|
||||
|
||||
# Bug Fixes
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ var GameObject = require('../GameObject');
|
|||
var GetPowerOfTwo = require('../../math/pow2/GetPowerOfTwo');
|
||||
var Smoothing = require('../../display/canvas/Smoothing');
|
||||
var TileSpriteRender = require('./TileSpriteRender');
|
||||
var UUID = require('../../utils/string/UUID');
|
||||
var Vector2 = require('../../math/Vector2');
|
||||
|
||||
// bitmask flag for GameObject.renderMask
|
||||
|
@ -219,6 +220,16 @@ var TileSprite = new Class({
|
|||
*/
|
||||
this._crop = this.resetCropObject();
|
||||
|
||||
/**
|
||||
* The internal unique key to refer to the texture in the TextureManager.
|
||||
*
|
||||
* @name Phaser.GameObjects.TileSprite#_textureKey
|
||||
* @type {string}
|
||||
* @private
|
||||
* @since 3.80.0
|
||||
*/
|
||||
this._textureKey = UUID();
|
||||
|
||||
/**
|
||||
* The Texture this Game Object is using to render with.
|
||||
*
|
||||
|
@ -226,7 +237,7 @@ var TileSprite = new Class({
|
|||
* @type {Phaser.Textures.Texture|Phaser.Textures.CanvasTexture}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.texture = scene.sys.textures.addCanvas(null, this.canvas, true);
|
||||
this.texture = scene.sys.textures.addCanvas(this._textureKey, this.canvas);
|
||||
|
||||
/**
|
||||
* The Texture Frame this Game Object is using to render with.
|
||||
|
@ -556,7 +567,12 @@ var TileSprite = new Class({
|
|||
this.displayTexture = null;
|
||||
this.displayFrame = null;
|
||||
|
||||
this.texture.destroy();
|
||||
var texture = this.texture;
|
||||
|
||||
if (texture)
|
||||
{
|
||||
texture.destroy();
|
||||
}
|
||||
|
||||
this.renderer = null;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue