mirror of
https://github.com/wassname/phaser.git
synced 2026-07-12 00:50:45 +08:00
More Docs!
This commit is contained in:
@@ -2,10 +2,8 @@
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
* @copyright 2013 Photon Storm Ltd.
|
||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
* @module Phaser.RequestAnimationFrame
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Abstracts away the use of RAF or setTimeOut for the core game update loop.
|
||||
*
|
||||
@@ -39,26 +37,28 @@ Phaser.RequestAnimationFrame = function(game) {
|
||||
'o'
|
||||
];
|
||||
|
||||
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; x++) {
|
||||
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; x++)
|
||||
{
|
||||
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
|
||||
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'];
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Phaser.RequestAnimationFrame.prototype = {
|
||||
|
||||
/**
|
||||
* The function called by the update
|
||||
* @property _onLoop
|
||||
* @private
|
||||
**/
|
||||
_onLoop: null,
|
||||
*/
|
||||
this._onLoop = null;
|
||||
|
||||
};
|
||||
|
||||
Phaser.RequestAnimationFrame.prototype = {
|
||||
|
||||
|
||||
/**
|
||||
* Starts the requestAnimatioFrame running or setTimeout if unavailable in browser
|
||||
* @method start
|
||||
**/
|
||||
* @method Phaser.RequestAnimationFrame#start
|
||||
*/
|
||||
start: function () {
|
||||
|
||||
this.isRunning = true;
|
||||
@@ -90,9 +90,9 @@ Phaser.RequestAnimationFrame.prototype = {
|
||||
|
||||
/**
|
||||
* The update method for the requestAnimationFrame
|
||||
* @method updateRAF
|
||||
* @param {number} time - Description.
|
||||
**/
|
||||
* @method Phaser.RequestAnimationFrame#updateRAF
|
||||
* @param {number} time - A timestamp, either from RAF or setTimeOut
|
||||
*/
|
||||
updateRAF: function (time) {
|
||||
|
||||
this.game.update(time);
|
||||
@@ -103,8 +103,8 @@ Phaser.RequestAnimationFrame.prototype = {
|
||||
|
||||
/**
|
||||
* The update method for the setTimeout.
|
||||
* @method updateSetTimeout
|
||||
**/
|
||||
* @method Phaser.RequestAnimationFrame#updateSetTimeout
|
||||
*/
|
||||
updateSetTimeout: function () {
|
||||
|
||||
this.game.update(Date.now());
|
||||
@@ -115,8 +115,8 @@ Phaser.RequestAnimationFrame.prototype = {
|
||||
|
||||
/**
|
||||
* Stops the requestAnimationFrame from running.
|
||||
* @method stop
|
||||
**/
|
||||
* @method Phaser.RequestAnimationFrame#stop
|
||||
*/
|
||||
stop: function () {
|
||||
|
||||
if (this._isSetTimeOut)
|
||||
@@ -134,18 +134,18 @@ Phaser.RequestAnimationFrame.prototype = {
|
||||
|
||||
/**
|
||||
* Is the browser using setTimeout?
|
||||
* @method isSetTimeOut
|
||||
* @method Phaser.RequestAnimationFrame#isSetTimeOut
|
||||
* @return {boolean}
|
||||
**/
|
||||
*/
|
||||
isSetTimeOut: function () {
|
||||
return this._isSetTimeOut;
|
||||
},
|
||||
|
||||
/**
|
||||
* Is the browser using requestAnimationFrame?
|
||||
* @method isRAF
|
||||
* @method Phaser.RequestAnimationFrame#isRAF
|
||||
* @return {boolean}
|
||||
**/
|
||||
*/
|
||||
isRAF: function () {
|
||||
return (this._isSetTimeOut === false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user