Skip to content

Commit 5054344

Browse files
committed
The LoadTexture component has a new property: customRender which is checked for in the Core postUpdate to know when to render custom elements like Videos.
1 parent 312c31b commit 5054344

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/gameobjects/components/Core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ Phaser.Component.Core.prototype = {
311311
*/
312312
postUpdate: function() {
313313

314-
if (this.key instanceof Phaser.BitmapData || this.key instanceof Phaser.Video)
314+
if (this.customRender)
315315
{
316316
this.key.render();
317317
}

src/gameobjects/components/LoadTexture.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ Phaser.Component.LoadTexture = function () {};
1313

1414
Phaser.Component.LoadTexture.prototype = {
1515

16+
/**
17+
* @property {boolean} customRender - Does this texture require a custom render call? (as set by BitmapData, Video, etc)
18+
* @private
19+
*/
20+
customRender: false,
21+
1622
/**
1723
* @property {Phaser.Rectangle} _frame - Internal cache var.
1824
* @private
@@ -43,6 +49,7 @@ Phaser.Component.LoadTexture.prototype = {
4349
}
4450

4551
this.key = key;
52+
this.customRender = false;
4653

4754
var setFrame = true;
4855
var smoothed = !this.texture.baseTexture.scaleMode;
@@ -54,6 +61,8 @@ Phaser.Component.LoadTexture.prototype = {
5461
}
5562
else if (Phaser.BitmapData && key instanceof Phaser.BitmapData)
5663
{
64+
this.customRender = true;
65+
5766
// This works from a reference, which probably isn't what we need here
5867
this.setTexture(key.texture);
5968

@@ -64,6 +73,8 @@ Phaser.Component.LoadTexture.prototype = {
6473
}
6574
else if (Phaser.Video && key instanceof Phaser.Video)
6675
{
76+
this.customRender = true;
77+
6778
// This works from a reference, which probably isn't what we need here
6879
var valid = key.texture.valid;
6980
this.setTexture(key.texture);

0 commit comments

Comments
 (0)