Added Game configuration option: forceSetTimeOut

This commit is contained in:
photonstorm
2014-02-20 01:31:13 +00:00
parent f07c10e38e
commit 4ad7b304c6
3 changed files with 23 additions and 4 deletions
+9 -1
View File
@@ -466,7 +466,15 @@ Phaser.Game.prototype = {
this.isRunning = true;
this._loadComplete = false;
this.raf = new Phaser.RequestAnimationFrame(this);
if (this.config && this.config['forceSetTimeOut'])
{
this.raf = new Phaser.RequestAnimationFrame(this, this.config['forceSetTimeOut']);
}
else
{
this.raf = new Phaser.RequestAnimationFrame(this, false);
}
this.raf.start();
}
+4 -1
View File
@@ -5,7 +5,10 @@
*/
/**
* Create a new `Text` object.
* Create a new `Text` object. This uses a local hidden Canvas object and renders the type into it. It then makes a texture from this for renderning to the view.
* Because of this you can only display fonts that are currently loaded and available to the browser. It won't load the fonts for you.
* Here is a compatibility table showing the available default fonts across different mobile browsers: http://www.jordanm.co.uk/tinytype
*
* @class Phaser.Text
* @constructor
* @param {Phaser.Game} game - Current game instance.
+10 -2
View File
@@ -10,9 +10,12 @@
* @class Phaser.RequestAnimationFrame
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {boolean} [forceSetTimeOut=false] - Tell Phaser to use setTimeOut even if raf is available.
*/
Phaser.RequestAnimationFrame = function(game) {
Phaser.RequestAnimationFrame = function(game, forceSetTimeOut) {
if (typeof forceSetTimeOut === 'undefined') { forceSetTimeOut = false; }
/**
* @property {Phaser.Game} game - The currently running game.
*/
@@ -24,6 +27,11 @@ Phaser.RequestAnimationFrame = function(game) {
*/
this.isRunning = false;
/**
* @property {boolean} forceSetTimeOut - Tell Phaser to use setTimeOut even if raf is available.
*/
this.forceSetTimeOut = forceSetTimeOut;
var vendors = [
'ms',
'moz',
@@ -69,7 +77,7 @@ Phaser.RequestAnimationFrame.prototype = {
var _this = this;
if (!window.requestAnimationFrame)
if (!window.requestAnimationFrame || this.forceSetTimeOut)
{
this._isSetTimeOut = true;