mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 20:53:39 +00:00
The Debug canvas now listens for the ScaleManager.onSizeChange signal and resizes itself accordingly when running under WebGL. This means if your game size changes the Debug canvas won't be clipped off (thanks @francisberesford #1919)
This commit is contained in:
parent
7b803135c8
commit
8ad7b25595
2 changed files with 23 additions and 0 deletions
|
@ -340,6 +340,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
|
||||||
* The Destroy component will now call TweenManager.removeFrom, removing any active tweens from the TweenManager upon the Game Objects destructions (thanks @PokemonAshLovesMyTurkeyAndILikeYouTwo #2408)
|
* The Destroy component will now call TweenManager.removeFrom, removing any active tweens from the TweenManager upon the Game Objects destructions (thanks @PokemonAshLovesMyTurkeyAndILikeYouTwo #2408)
|
||||||
* Tween.update will now return `false` (flagging the Tween for destruction) should the Tween.target property every become falsey. This can happen if the object the Tween was tracking is destroyed, nulled or generally removed.
|
* Tween.update will now return `false` (flagging the Tween for destruction) should the Tween.target property every become falsey. This can happen if the object the Tween was tracking is destroyed, nulled or generally removed.
|
||||||
* TweenData.repeatTotal is a new property that keeps track of the total number of times the Tween should repeat. If TweenData.start is called, as a result of the Tween repeatCount being > 0 then the child tween resets its total before re-starting.
|
* TweenData.repeatTotal is a new property that keeps track of the total number of times the Tween should repeat. If TweenData.start is called, as a result of the Tween repeatCount being > 0 then the child tween resets its total before re-starting.
|
||||||
|
* The Debug canvas now listens for the ScaleManager.onSizeChange signal and resizes itself accordingly when running under WebGL. This means if your game size changes the Debug canvas won't be clipped off (thanks @francisberesford #1919)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
|
|
@ -108,16 +108,38 @@ Phaser.Utils.Debug.prototype = {
|
||||||
this.sprite = this.game.make.image(0, 0, this.bmd);
|
this.sprite = this.game.make.image(0, 0, this.bmd);
|
||||||
this.game.stage.addChild(this.sprite);
|
this.game.stage.addChild(this.sprite);
|
||||||
|
|
||||||
|
this.game.scale.onSizeChange.add(this.resize, this);
|
||||||
|
|
||||||
this.canvas = PIXI.CanvasPool.create(this, this.game.width, this.game.height);
|
this.canvas = PIXI.CanvasPool.create(this, this.game.width, this.game.height);
|
||||||
this.context = this.canvas.getContext('2d');
|
this.context = this.canvas.getContext('2d');
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal method that resizes the BitmapData and Canvas.
|
||||||
|
* Called by ScaleManager.onSizeChange only in WebGL mode.
|
||||||
|
*
|
||||||
|
* @method Phaser.Utils.Debug#resize
|
||||||
|
* @protected
|
||||||
|
* @param {Phaser.ScaleManager} scaleManager - The Phaser ScaleManager.
|
||||||
|
* @param {number} width - The new width of the game.
|
||||||
|
* @param {number} height - The new height of the game.
|
||||||
|
*/
|
||||||
|
resize: function (scaleManager, width, height) {
|
||||||
|
|
||||||
|
this.bmd.resize(width, height);
|
||||||
|
|
||||||
|
this.canvas.width = width;
|
||||||
|
this.canvas.height = height;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal method that clears the canvas (if a Sprite) ready for a new debug session.
|
* Internal method that clears the canvas (if a Sprite) ready for a new debug session.
|
||||||
*
|
*
|
||||||
* @method Phaser.Utils.Debug#preUpdate
|
* @method Phaser.Utils.Debug#preUpdate
|
||||||
|
* @protected
|
||||||
*/
|
*/
|
||||||
preUpdate: function () {
|
preUpdate: function () {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue