mirror of
https://github.com/wassname/phaser.git
synced 2026-09-10 12:29:30 +08:00
Fixed instance check issue in Game and tidied up the stageScaleMode inner loop.
This commit is contained in:
+2
-2
@@ -38,11 +38,11 @@ module Phaser {
|
||||
constructor(callbackContext, parent: string = '', width: number = 800, height: number = 600, preloadCallback = null, createCallback = null, updateCallback = null, renderCallback = null, destroyCallback = null) {
|
||||
|
||||
// Single instance check
|
||||
if (window['PhaserGlobal'].singleInstance)
|
||||
if (window['PhaserGlobal'] && window['PhaserGlobal'].singleInstance)
|
||||
{
|
||||
if (Phaser.GAMES.length > 0)
|
||||
{
|
||||
console.log('Phaser detected an instance of this game already running, aborting');
|
||||
throw new Error('Phaser detected an instance of this game already running, aborting');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ module Phaser {
|
||||
|
||||
}
|
||||
|
||||
public game: Phaser.Game;
|
||||
|
||||
/**
|
||||
* X position within the image to cut from.
|
||||
* @type {number}
|
||||
|
||||
@@ -95,8 +95,21 @@ module Phaser {
|
||||
|
||||
for (var i = 0; i < frames.length; i++)
|
||||
{
|
||||
newFrame = data.addFrame(new Frame(frames[i].frame.x, frames[i].frame.y, frames[i].frame.w, frames[i].frame.h, frames[i].filename));
|
||||
newFrame.setTrim(frames[i].trimmed, frames[i].sourceSize.w, frames[i].sourceSize.h, frames[i].spriteSourceSize.x, frames[i].spriteSourceSize.y, frames[i].spriteSourceSize.w, frames[i].spriteSourceSize.h);
|
||||
newFrame = data.addFrame(new Frame(
|
||||
frames[i].frame.x,
|
||||
frames[i].frame.y,
|
||||
frames[i].frame.w,
|
||||
frames[i].frame.h,
|
||||
frames[i].filename));
|
||||
|
||||
newFrame.setTrim(
|
||||
frames[i].trimmed,
|
||||
frames[i].sourceSize.w,
|
||||
frames[i].sourceSize.h,
|
||||
frames[i].spriteSourceSize.x,
|
||||
frames[i].spriteSourceSize.y,
|
||||
frames[i].spriteSourceSize.w,
|
||||
frames[i].spriteSourceSize.h);
|
||||
}
|
||||
|
||||
return data;
|
||||
|
||||
@@ -160,10 +160,10 @@ module Phaser {
|
||||
public aspectRatio: number;
|
||||
|
||||
/**
|
||||
* The maximum number of times it will try to resize the canvas to fill the browser (default is 10)
|
||||
* The maximum number of times it will try to resize the canvas to fill the browser (default is 5)
|
||||
* @type {number}
|
||||
*/
|
||||
public maxIterations: number = 10;
|
||||
public maxIterations: number = 5;
|
||||
|
||||
/**
|
||||
* The scale factor of the scaled game width
|
||||
@@ -247,6 +247,12 @@ module Phaser {
|
||||
*/
|
||||
public update() {
|
||||
|
||||
if (this.forceLandscape || this.forcePortrait)
|
||||
{
|
||||
this.checkOrientationState();
|
||||
}
|
||||
|
||||
/*
|
||||
if (this.game.stage.scaleMode !== Phaser.StageScaleMode.NO_SCALE && (window.innerWidth !== this.width || window.innerHeight !== this.height))
|
||||
{
|
||||
this.refresh();
|
||||
@@ -256,6 +262,7 @@ module Phaser {
|
||||
{
|
||||
this.checkOrientationState();
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user