@@ -5963,7 +5963,7 @@ var Phaser;
59635963 this.maxHeight = null;
59645964 this.width = 0;
59655965 this.height = 0;
5966- this.maxIterations = 10 ;
5966+ this.maxIterations = 5 ;
59675967 this.game = game;
59685968 this.enterLandscape = new Phaser.Signal();
59695969 this.enterPortrait = new Phaser.Signal();
@@ -6025,9 +6025,6 @@ var Phaser;
60256025 }
60266026 };
60276027 StageScaleMode.prototype.update = function () {
6028- if(this.game.stage.scaleMode !== Phaser.StageScaleMode.NO_SCALE && (window.innerWidth !== this.width || window.innerHeight !== this.height)) {
6029- this.refresh();
6030- }
60316028 if(this.forceLandscape || this.forcePortrait) {
60326029 this.checkOrientationState();
60336030 }
@@ -6934,7 +6931,6 @@ var Phaser;
69346931 this.delay = 1000 / frameRate;
69356932 }
69366933 if(loop !== null) {
6937- console.log('play loop override', loop);
69386934 this.looped = loop;
69396935 }
69406936 this.isPlaying = true;
@@ -6966,9 +6962,7 @@ var Phaser;
69666962 this._frameIndex = 0;
69676963 this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
69686964 this._parent.events.onAnimationLoop.dispatch(this._parent, this);
6969- console.log('anim loop core');
69706965 } else {
6971- console.log('anim complete core');
69726966 this.onComplete();
69736967 }
69746968 } else {
@@ -7059,7 +7053,7 @@ var Phaser;
70597053 };
70607054 AnimationManager.prototype.play = function (name, frameRate, loop) {
70617055 if (typeof frameRate === "undefined") { frameRate = null; }
7062- if (typeof loop === "undefined") { loop = false ; }
7056+ if (typeof loop === "undefined") { loop = null ; }
70637057 if(this._anims[name]) {
70647058 if(this.currentAnim == this._anims[name]) {
70657059 if(this.currentAnim.isPlaying == false) {
@@ -7881,6 +7875,8 @@ var Phaser;
78817875 }
78827876 var width = img.width;
78837877 var height = img.height;
7878+ frameWidth *= game.stage.globalScale;
7879+ frameHeight *= game.stage.globalScale;
78847880 var row = Math.round(width / frameWidth);
78857881 var column = Math.round(height / frameHeight);
78867882 var total = row * column;
@@ -12658,14 +12654,21 @@ var Phaser;
1265812654 this._dw = sprite.crop.width * sprite.transform.scale.x;
1265912655 this._dh = sprite.crop.height * sprite.transform.scale.y;
1266012656 }
12661- this._sx = Math.floor(this._sx);
12662- this._sy = Math.floor(this._sy);
12663- this._sw = Math.floor(this._sw);
12664- this._sh = Math.floor(this._sh);
12665- this._dx = Math.floor(this._dx);
12666- this._dy = Math.floor(this._dy);
12667- this._dw = Math.floor(this._dw);
12668- this._dh = Math.floor(this._dh);
12657+ if(this.game.stage.globalScale != 1) {
12658+ this._sx = Math.floor(this._sx * this.game.stage.globalScale);
12659+ this._sy = Math.floor(this._sy * this.game.stage.globalScale);
12660+ this._dx = Math.floor(this._dx * this.game.stage.globalScale);
12661+ this._dy = Math.floor(this._dy * this.game.stage.globalScale);
12662+ } else {
12663+ this._sx = Math.floor(this._sx);
12664+ this._sy = Math.floor(this._sy);
12665+ this._sw = Math.floor(this._sw);
12666+ this._sh = Math.floor(this._sh);
12667+ this._dx = Math.floor(this._dx);
12668+ this._dy = Math.floor(this._dy);
12669+ this._dw = Math.floor(this._dw);
12670+ this._dh = Math.floor(this._dh);
12671+ }
1266912672 if(this._sw <= 0 || this._sh <= 0 || this._dw <= 0 || this._dh <= 0) {
1267012673 return false;
1267112674 }
@@ -13984,6 +13987,7 @@ var Phaser;
1398413987 var Stage = (function () {
1398513988 function Stage(game, parent, width, height) {
1398613989 var _this = this;
13990+ this.globalScale = 1;
1398713991 this._backgroundColor = 'rgb(0,0,0)';
1398813992 this.clear = true;
1398913993 this.disablePauseScreen = false;
@@ -14259,6 +14263,12 @@ var Phaser;
1425914263 this.onDestroyCallback = null;
1426014264 this.isBooted = false;
1426114265 this.isRunning = false;
14266+ if(window['PhaserGlobal'].singleInstance) {
14267+ if(Phaser.GAMES.length > 0) {
14268+ console.log('Phaser detected an instance of this game already running, aborting');
14269+ return;
14270+ }
14271+ }
1426214272 this.id = Phaser.GAMES.push(this) - 1;
1426314273 this.callbackContext = callbackContext;
1426414274 this.onPreloadCallback = preloadCallback;
0 commit comments