Skip to content

Commit c33b53f

Browse files
committed
BitmapData has a new property frameData which is a Phaser.FrameData container instance. It contains a single Frame by default, matching the dimensions of the entire BitmapData, but can be populated with additional frames should you wish to create animations from dynamic BitmapData textures.
1 parent 18c0b15 commit c33b53f

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/gameobjects/BitmapData.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,16 @@ Phaser.BitmapData = function (game, key, width, height) {
122122
*/
123123
this.texture = new PIXI.Texture(this.baseTexture);
124124

125+
/**
126+
* @property {Phaser.FrameData} frameData - The FrameData container this BitmapData uses for rendering.
127+
*/
128+
this.frameData = new Phaser.FrameData();
129+
125130
/**
126131
* @property {Phaser.Frame} textureFrame - The Frame this BitmapData uses for rendering.
127132
* @default
128133
*/
129-
this.textureFrame = new Phaser.Frame(0, 0, 0, width, height, 'bitmapData');
134+
this.textureFrame = this.frameData.addFrame(new Phaser.Frame(0, 0, 0, width, height, 'bitmapData'));
130135

131136
this.texture.frame = this.textureFrame;
132137

@@ -1858,6 +1863,8 @@ Phaser.BitmapData.prototype = {
18581863
*/
18591864
destroy: function () {
18601865

1866+
this.frameData.destroy();
1867+
18611868
this.texture.destroy(true);
18621869

18631870
PIXI.CanvasPool.remove(this);

0 commit comments

Comments
 (0)