Fixed instance check issue in Game and tidied up the stageScaleMode inner loop.

This commit is contained in:
Richard Davey
2013-08-16 02:18:12 +01:00
parent f76ba6840f
commit c884bab7ec
6 changed files with 55 additions and 26 deletions
+2 -2
View File
@@ -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;
}
}
+2
View File
@@ -38,6 +38,8 @@ module Phaser {
}
public game: Phaser.Game;
/**
* X position within the image to cut from.
* @type {number}
+15 -2
View File
@@ -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;
+9 -2
View File
@@ -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();
}
*/
}