Skip to content

Commit 21c0be4

Browse files
committed
BitmapDatas when used as Game Object textures in WebGL now update themselves properly.
Timer.ms now correctly reports the ms time even if the Timer has been paused (thanks Nambew, fix phaserjs#624)
1 parent 0fa54b0 commit 21c0be4

6 files changed

Lines changed: 14 additions & 5 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ Bug Fixes
9494
* p2 revolute pivots were wrongly signed (thanks georgiee, fix #621)
9595
* P2.Body.loadPolygon no longer modifies the Cache array (fix #613)
9696
* The volume given in Sound.play now over-rides that set in Sound.addMarker if specified (fix #623)
97+
* BitmapDatas when used as Game Object textures in WebGL now update themselves properly.
98+
* Timer.ms now correctly reports the ms time even if the Timer has been paused (thanks Nambew, fix #624)
9799

98100

99101
Updated

src/gameobjects/BitmapData.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ Phaser.BitmapData.prototype = {
364364
*/
365365
render: function () {
366366

367-
console.log('bmd dity');
368367
if (this.game.renderType === Phaser.WEBGL && this.dirty)
369368
{
370369
// Only needed if running in WebGL, otherwise this array will never get cleared down

src/gameobjects/Image.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Phaser.Image.prototype.loadTexture = function (key, frame) {
225225
}
226226
else if (key instanceof Phaser.BitmapData)
227227
{
228-
this.key = key.key;
228+
this.key = key;
229229
this.setTexture(key.texture);
230230
return;
231231
}

src/gameobjects/Sprite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame) {
354354
}
355355
else if (key instanceof Phaser.BitmapData)
356356
{
357-
this.key = key.key;
357+
this.key = key;
358358
this.setTexture(key.texture);
359359
return;
360360
}

src/gameobjects/TileSprite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ Phaser.TileSprite.prototype.loadTexture = function (key, frame) {
341341
}
342342
else if (key instanceof Phaser.BitmapData)
343343
{
344-
this.key = key.key;
344+
this.key = key;
345345
this.setTexture(key.texture);
346346
return;
347347
}

src/time/Timer.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ Phaser.Timer = function (game, autoDestroy) {
8585
*/
8686
this._pauseStarted = 0;
8787

88+
/**
89+
* @property {number} _pauseTotal - Total paused time.
90+
* @private
91+
*/
92+
this._pauseTotal = 0;
93+
8894
/**
8995
* @property {number} _now - The current start-time adjusted time.
9096
* @private
@@ -450,6 +456,8 @@ Phaser.Timer.prototype = {
450456
{
451457
var pauseDuration = this.game.time.now - this._pauseStarted;
452458

459+
this._pauseTotal += pauseDuration;
460+
453461
for (var i = 0; i < this.events.length; i++)
454462
{
455463
this.events[i].tick += pauseDuration;
@@ -570,7 +578,7 @@ Object.defineProperty(Phaser.Timer.prototype, "length", {
570578
Object.defineProperty(Phaser.Timer.prototype, "ms", {
571579

572580
get: function () {
573-
return this._now - this._started;
581+
return this._now - this._started - this._pauseTotal;
574582
}
575583

576584
});

0 commit comments

Comments
 (0)