Updated so it no longer always tries to run in fullscreen unless you tell it to.

This commit is contained in:
Richard Davey
2013-04-13 20:17:51 +01:00
parent 5f130324c9
commit 0541e93db4
7 changed files with 17446 additions and 4 deletions
+6 -1
View File
@@ -4098,7 +4098,7 @@ var FullScreen = (function () {
this.refresh();
};
FullScreen.prototype.update = function () {
if(window.innerWidth !== this.width || window.innerHeight !== this.height) {
if(this._game.stage.scaleMode !== Stage.SCALE_FIXED && (window.innerWidth !== this.width || window.innerHeight !== this.height)) {
this.refresh();
}
};
@@ -4176,6 +4176,8 @@ var Stage = (function () {
this.context = this.canvas.getContext('2d');
this.offset = this.getOffset(this.canvas);
this.bounds = new Rectangle(this.offset.x, this.offset.y, width, height);
this.aspectRatio = width / height;
this.scaleMode = Stage.SCALE_FIXED;
this.fullscreen = new FullScreen(this._game);
//document.addEventListener('visibilitychange', (event) => this.visibilityChange(event), false);
//document.addEventListener('webkitvisibilitychange', (event) => this.visibilityChange(event), false);
@@ -4186,6 +4188,9 @@ var Stage = (function () {
return _this.visibilityChange(event);
};
}
Stage.SCALE_FIXED = 0;
Stage.SCALE_PROPORTIONAL = 1;
Stage.SCALE_FULL = 2;
Stage.ORIENTATION_LANDSCAPE = 0;
Stage.ORIENTATION_PORTRAIT = 1;
Stage.prototype.update = function () {