mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 23:24:41 +00:00
Updates across the board moving Stage.canvas to Game.canvas
This commit is contained in:
parent
0786e86ee5
commit
e9fb8f6389
8 changed files with 24 additions and 23 deletions
|
@ -82,7 +82,7 @@ Significant API changes:
|
|||
* Stage.aspectRatio has been moved to StageScaleMode.sourceAspectRatio (so now game.scale.sourceAspectRatio)
|
||||
* Stage.scaleMode has been moved to StageScaleMode.scaleMode (so now game.scale.scaleMode)
|
||||
* Stage.fullScreenScaleMode has been moved to StageScaleMode.fullScreenScaleMode (so now game.scale.fullScreenScaleMode)
|
||||
* Stage.canvas has been removed. It was only ever an alias for Game.canvas anyway, so access it via that instead.
|
||||
* Stage.canvas has been moved to Game.canvas (which used to be a reference to Stage.canvas, but is now the actual object).
|
||||
|
||||
|
||||
New features:
|
||||
|
|
|
@ -532,7 +532,7 @@ Phaser.Game.prototype = {
|
|||
this.renderType = Phaser.CANVAS;
|
||||
}
|
||||
|
||||
this.renderer = new PIXI.CanvasRenderer(this.width, this.height, this.stage.canvas, this.transparent);
|
||||
this.renderer = new PIXI.CanvasRenderer(this.width, this.height, this.canvas, this.transparent);
|
||||
Phaser.Canvas.setSmoothingEnabled(this.renderer.context, this.antialias);
|
||||
this.canvas = this.renderer.view;
|
||||
this.context = this.renderer.context;
|
||||
|
@ -546,7 +546,7 @@ Phaser.Game.prototype = {
|
|||
{
|
||||
// They requested WebGL, and their browser supports it
|
||||
this.renderType = Phaser.WEBGL;
|
||||
this.renderer = new PIXI.WebGLRenderer(this.width, this.height, this.stage.canvas, this.transparent, this.antialias);
|
||||
this.renderer = new PIXI.WebGLRenderer(this.width, this.height, this.canvas, this.transparent, this.antialias);
|
||||
this.canvas = this.renderer.view;
|
||||
this.context = null;
|
||||
}
|
||||
|
|
|
@ -62,8 +62,8 @@ Phaser.Stage = function (game, width, height) {
|
|||
}
|
||||
else
|
||||
{
|
||||
this.canvas = Phaser.Canvas.create(width, height);
|
||||
this.canvas.style['-webkit-full-screen'] = 'width: 100%; height: 100%';
|
||||
this.game.canvas = Phaser.Canvas.create(width, height);
|
||||
this.game.canvas.style['-webkit-full-screen'] = 'width: 100%; height: 100%';
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -334,6 +334,7 @@ Phaser.StateManager.prototype = {
|
|||
this.states[key].load = this.game.load;
|
||||
this.states[key].math = this.game.math;
|
||||
this.states[key].sound = this.game.sound;
|
||||
this.states[key].scale = this.game.scale;
|
||||
this.states[key].stage = this.game.stage;
|
||||
this.states[key].time = this.game.time;
|
||||
this.states[key].tweens = this.game.tweens;
|
||||
|
|
|
@ -155,13 +155,13 @@ Phaser.MSPointer.prototype = {
|
|||
*/
|
||||
stop: function () {
|
||||
|
||||
this.game.stage.canvas.removeEventListener('MSPointerDown', this._onMSPointerDown);
|
||||
this.game.stage.canvas.removeEventListener('MSPointerMove', this._onMSPointerMove);
|
||||
this.game.stage.canvas.removeEventListener('MSPointerUp', this._onMSPointerUp);
|
||||
this.game.canvas.removeEventListener('MSPointerDown', this._onMSPointerDown);
|
||||
this.game.canvas.removeEventListener('MSPointerMove', this._onMSPointerMove);
|
||||
this.game.canvas.removeEventListener('MSPointerUp', this._onMSPointerUp);
|
||||
|
||||
this.game.stage.canvas.removeEventListener('pointerDown', this._onMSPointerDown);
|
||||
this.game.stage.canvas.removeEventListener('pointerMove', this._onMSPointerMove);
|
||||
this.game.stage.canvas.removeEventListener('pointerUp', this._onMSPointerUp);
|
||||
this.game.canvas.removeEventListener('pointerDown', this._onMSPointerDown);
|
||||
this.game.canvas.removeEventListener('pointerMove', this._onMSPointerMove);
|
||||
this.game.canvas.removeEventListener('pointerUp', this._onMSPointerUp);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ Phaser.Mouse.prototype = {
|
|||
|
||||
if (this.game.device.pointerLock)
|
||||
{
|
||||
var element = this.game.stage.canvas;
|
||||
var element = this.game.canvas;
|
||||
|
||||
element.requestPointerLock = element.requestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock;
|
||||
|
||||
|
@ -281,7 +281,7 @@ Phaser.Mouse.prototype = {
|
|||
*/
|
||||
pointerLockChange: function (event) {
|
||||
|
||||
var element = this.game.stage.canvas;
|
||||
var element = this.game.canvas;
|
||||
|
||||
if (document.pointerLockElement === element || document.mozPointerLockElement === element || document.webkitPointerLockElement === element)
|
||||
{
|
||||
|
|
|
@ -356,12 +356,12 @@ Phaser.Touch.prototype = {
|
|||
|
||||
if (this.game.device.touch)
|
||||
{
|
||||
this.game.stage.canvas.removeEventListener('touchstart', this._onTouchStart);
|
||||
this.game.stage.canvas.removeEventListener('touchmove', this._onTouchMove);
|
||||
this.game.stage.canvas.removeEventListener('touchend', this._onTouchEnd);
|
||||
this.game.stage.canvas.removeEventListener('touchenter', this._onTouchEnter);
|
||||
this.game.stage.canvas.removeEventListener('touchleave', this._onTouchLeave);
|
||||
this.game.stage.canvas.removeEventListener('touchcancel', this._onTouchCancel);
|
||||
this.game.canvas.removeEventListener('touchstart', this._onTouchStart);
|
||||
this.game.canvas.removeEventListener('touchmove', this._onTouchMove);
|
||||
this.game.canvas.removeEventListener('touchend', this._onTouchEnd);
|
||||
this.game.canvas.removeEventListener('touchenter', this._onTouchEnter);
|
||||
this.game.canvas.removeEventListener('touchleave', this._onTouchLeave);
|
||||
this.game.canvas.removeEventListener('touchcancel', this._onTouchCancel);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -320,8 +320,8 @@ Phaser.StageScaleMode.prototype = {
|
|||
{
|
||||
if (this.fullScreenScaleMode === Phaser.StageScaleMode.EXACT_FIT)
|
||||
{
|
||||
this.game.stage.canvas.style['width'] = '100%';
|
||||
this.game.stage.canvas.style['height'] = '100%';
|
||||
this.game.canvas.style['width'] = '100%';
|
||||
this.game.canvas.style['height'] = '100%';
|
||||
|
||||
this.setMaximum();
|
||||
|
||||
|
@ -339,8 +339,8 @@ Phaser.StageScaleMode.prototype = {
|
|||
}
|
||||
else
|
||||
{
|
||||
this.game.stage.canvas.style['width'] = this.game.width + 'px';
|
||||
this.game.stage.canvas.style['height'] = this.game.height + 'px';
|
||||
this.game.canvas.style['width'] = this.game.width + 'px';
|
||||
this.game.canvas.style['height'] = this.game.height + 'px';
|
||||
|
||||
this.width = this._width;
|
||||
this.height = this._height;
|
||||
|
|
Loading…
Reference in a new issue