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 #624)
This commit is contained in:
photonstorm 2014-03-21 18:37:54 +00:00
parent 0fa54b0b24
commit 21c0be4d02
6 changed files with 14 additions and 5 deletions

View file

@ -94,6 +94,8 @@ Bug Fixes
* p2 revolute pivots were wrongly signed (thanks georgiee, fix #621)
* P2.Body.loadPolygon no longer modifies the Cache array (fix #613)
* The volume given in Sound.play now over-rides that set in Sound.addMarker if specified (fix #623)
* 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 #624)
Updated

View file

@ -364,7 +364,6 @@ Phaser.BitmapData.prototype = {
*/
render: function () {
console.log('bmd dity');
if (this.game.renderType === Phaser.WEBGL && this.dirty)
{
// Only needed if running in WebGL, otherwise this array will never get cleared down

View file

@ -225,7 +225,7 @@ Phaser.Image.prototype.loadTexture = function (key, frame) {
}
else if (key instanceof Phaser.BitmapData)
{
this.key = key.key;
this.key = key;
this.setTexture(key.texture);
return;
}

View file

@ -354,7 +354,7 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame) {
}
else if (key instanceof Phaser.BitmapData)
{
this.key = key.key;
this.key = key;
this.setTexture(key.texture);
return;
}

View file

@ -341,7 +341,7 @@ Phaser.TileSprite.prototype.loadTexture = function (key, frame) {
}
else if (key instanceof Phaser.BitmapData)
{
this.key = key.key;
this.key = key;
this.setTexture(key.texture);
return;
}

View file

@ -85,6 +85,12 @@ Phaser.Timer = function (game, autoDestroy) {
*/
this._pauseStarted = 0;
/**
* @property {number} _pauseTotal - Total paused time.
* @private
*/
this._pauseTotal = 0;
/**
* @property {number} _now - The current start-time adjusted time.
* @private
@ -450,6 +456,8 @@ Phaser.Timer.prototype = {
{
var pauseDuration = this.game.time.now - this._pauseStarted;
this._pauseTotal += pauseDuration;
for (var i = 0; i < this.events.length; i++)
{
this.events[i].tick += pauseDuration;
@ -570,7 +578,7 @@ Object.defineProperty(Phaser.Timer.prototype, "length", {
Object.defineProperty(Phaser.Timer.prototype, "ms", {
get: function () {
return this._now - this._started;
return this._now - this._started - this._pauseTotal;
}
});