mirror of
https://github.com/wassname/phaser.git
synced 2026-08-02 13:00:25 +08:00
Added Game configuration option: forceSetTimeOut
This commit is contained in:
+9
-1
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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,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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user