Skip to content

Commit d3b1081

Browse files
committed
Added destroy to tileSprite
1 parent ee4e0bf commit d3b1081

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

v3/src/gameobjects/tilesprite/TileSprite.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,20 @@ var TileSprite = new Class({
103103
this.canvasPattern = this.canvasBufferCtx.createPattern(this.canvasBuffer, 'repeat');
104104
}
105105
this.dirty = false;
106+
},
107+
108+
destroy: function ()
109+
{
110+
if (this.renderer)
111+
{
112+
this.renderer.gl.deleteTexture(this.tileTexture);
113+
}
114+
CanvasPool.remove(this.canvasBuffer);
115+
this.canvasPattern = null;
116+
this.canvasBufferCtx = null;
117+
this.canvasBuffer = null;
118+
this.renderer = null;
119+
this.visible = false;
106120
}
107121

108122
});

0 commit comments

Comments
 (0)