mirror of
https://github.com/wassname/phaser.git
synced 2026-07-14 01:10:16 +08:00
Updated documentation.
This commit is contained in:
+144
-107
@@ -54,6 +54,10 @@
|
||||
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||
</li>
|
||||
@@ -138,6 +142,10 @@
|
||||
<a href="Phaser.Events.html">Events</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Filter.html">Filter</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Frame.html">Frame</a>
|
||||
</li>
|
||||
@@ -302,6 +310,26 @@
|
||||
<a href="Phaser.Text.html">Text</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Tile.html">Tile</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Tileset.html">Tileset</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||
</li>
|
||||
@@ -310,6 +338,10 @@
|
||||
<a href="Phaser.Time.html">Time</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Timer.html">Timer</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Touch.html">Touch</a>
|
||||
</li>
|
||||
@@ -356,6 +388,14 @@
|
||||
<a href="global.html#HEXtoRGB">HEXtoRGB</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#render">render</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#renderXY">renderXY</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#right">right</a>
|
||||
</li>
|
||||
@@ -395,150 +435,147 @@
|
||||
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||
*/
|
||||
Phaser.RequestAnimationFrame = function(game) {
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} game - The currently running game.
|
||||
*/
|
||||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} game - The currently running game.
|
||||
*/
|
||||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {boolean} _isSetTimeOut - Description.
|
||||
* @private
|
||||
*/
|
||||
this._isSetTimeOut = false;
|
||||
|
||||
/**
|
||||
* @property {boolean} isRunning - Description.
|
||||
* @default
|
||||
*/
|
||||
this.isRunning = false;
|
||||
/**
|
||||
* @property {boolean} isRunning - true if RequestAnimationFrame is running, otherwise false.
|
||||
* @default
|
||||
*/
|
||||
this.isRunning = false;
|
||||
|
||||
var vendors = [
|
||||
'ms',
|
||||
'moz',
|
||||
'webkit',
|
||||
'o'
|
||||
];
|
||||
var vendors = [
|
||||
'ms',
|
||||
'moz',
|
||||
'webkit',
|
||||
'o'
|
||||
];
|
||||
|
||||
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; x++)
|
||||
{
|
||||
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
|
||||
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'];
|
||||
}
|
||||
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; x++)
|
||||
{
|
||||
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
|
||||
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'];
|
||||
}
|
||||
|
||||
/**
|
||||
* The function called by the update
|
||||
* @property _onLoop
|
||||
* @private
|
||||
*/
|
||||
this._onLoop = null;
|
||||
/**
|
||||
* @property {boolean} _isSetTimeOut - true if the browser is using setTimeout instead of raf.
|
||||
* @private
|
||||
*/
|
||||
this._isSetTimeOut = false;
|
||||
|
||||
/**
|
||||
* The callback ID used when calling cancel
|
||||
* @property _timeOutID
|
||||
* @private
|
||||
*/
|
||||
this._timeOutID = null;
|
||||
/**
|
||||
* @property {function} _onLoop - The function called by the update.
|
||||
* @private
|
||||
*/
|
||||
this._onLoop = null;
|
||||
|
||||
/**
|
||||
* @property {number} _timeOutID - The callback ID used when calling cancel.
|
||||
* @private
|
||||
*/
|
||||
this._timeOutID = null;
|
||||
|
||||
};
|
||||
|
||||
Phaser.RequestAnimationFrame.prototype = {
|
||||
|
||||
/**
|
||||
* Starts the requestAnimatioFrame running or setTimeout if unavailable in browser
|
||||
* @method Phaser.RequestAnimationFrame#start
|
||||
*/
|
||||
start: function () {
|
||||
|
||||
/**
|
||||
* Starts the requestAnimatioFrame running or setTimeout if unavailable in browser
|
||||
* @method Phaser.RequestAnimationFrame#start
|
||||
*/
|
||||
start: function () {
|
||||
this.isRunning = true;
|
||||
|
||||
this.isRunning = true;
|
||||
var _this = this;
|
||||
|
||||
var _this = this;
|
||||
|
||||
if (!window.requestAnimationFrame)
|
||||
{
|
||||
this._isSetTimeOut = true;
|
||||
if (!window.requestAnimationFrame)
|
||||
{
|
||||
this._isSetTimeOut = true;
|
||||
|
||||
this._onLoop = function () {
|
||||
return _this.updateSetTimeout();
|
||||
};
|
||||
|
||||
this._timeOutID = window.setTimeout(this._onLoop, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._isSetTimeOut = false;
|
||||
this._timeOutID = window.setTimeout(this._onLoop, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._isSetTimeOut = false;
|
||||
|
||||
this._onLoop = function (time) {
|
||||
return _this.updateRAF(time);
|
||||
};
|
||||
|
||||
this._timeOutID = window.requestAnimationFrame(this._onLoop);
|
||||
}
|
||||
this._timeOutID = window.requestAnimationFrame(this._onLoop);
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* The update method for the requestAnimationFrame
|
||||
* @method Phaser.RequestAnimationFrame#updateRAF
|
||||
* @param {number} time - A timestamp, either from RAF or setTimeOut
|
||||
*/
|
||||
updateRAF: function (time) {
|
||||
/**
|
||||
* The update method for the requestAnimationFrame
|
||||
* @method Phaser.RequestAnimationFrame#updateRAF
|
||||
* @param {number} time - A timestamp, either from RAF or setTimeOut
|
||||
*/
|
||||
updateRAF: function (time) {
|
||||
|
||||
this.game.update(time);
|
||||
this.game.update(time);
|
||||
|
||||
this._timeOutID = window.requestAnimationFrame(this._onLoop);
|
||||
this._timeOutID = window.requestAnimationFrame(this._onLoop);
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* The update method for the setTimeout.
|
||||
* @method Phaser.RequestAnimationFrame#updateSetTimeout
|
||||
*/
|
||||
updateSetTimeout: function () {
|
||||
/**
|
||||
* The update method for the setTimeout.
|
||||
* @method Phaser.RequestAnimationFrame#updateSetTimeout
|
||||
*/
|
||||
updateSetTimeout: function () {
|
||||
|
||||
this.game.update(Date.now());
|
||||
this.game.update(Date.now());
|
||||
|
||||
this._timeOutID = window.setTimeout(this._onLoop, this.game.time.timeToCall);
|
||||
this._timeOutID = window.setTimeout(this._onLoop, this.game.time.timeToCall);
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Stops the requestAnimationFrame from running.
|
||||
* @method Phaser.RequestAnimationFrame#stop
|
||||
*/
|
||||
stop: function () {
|
||||
/**
|
||||
* Stops the requestAnimationFrame from running.
|
||||
* @method Phaser.RequestAnimationFrame#stop
|
||||
*/
|
||||
stop: function () {
|
||||
|
||||
if (this._isSetTimeOut)
|
||||
{
|
||||
clearTimeout(this._timeOutID);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.cancelAnimationFrame(this._timeOutID);
|
||||
}
|
||||
if (this._isSetTimeOut)
|
||||
{
|
||||
clearTimeout(this._timeOutID);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.cancelAnimationFrame(this._timeOutID);
|
||||
}
|
||||
|
||||
this.isRunning = false;
|
||||
this.isRunning = false;
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Is the browser using setTimeout?
|
||||
* @method Phaser.RequestAnimationFrame#isSetTimeOut
|
||||
* @return {boolean}
|
||||
*/
|
||||
isSetTimeOut: function () {
|
||||
return this._isSetTimeOut;
|
||||
},
|
||||
/**
|
||||
* Is the browser using setTimeout?
|
||||
* @method Phaser.RequestAnimationFrame#isSetTimeOut
|
||||
* @return {boolean}
|
||||
*/
|
||||
isSetTimeOut: function () {
|
||||
return this._isSetTimeOut;
|
||||
},
|
||||
|
||||
/**
|
||||
* Is the browser using requestAnimationFrame?
|
||||
* @method Phaser.RequestAnimationFrame#isRAF
|
||||
* @return {boolean}
|
||||
*/
|
||||
isRAF: function () {
|
||||
return (this._isSetTimeOut === false);
|
||||
}
|
||||
/**
|
||||
* Is the browser using requestAnimationFrame?
|
||||
* @method Phaser.RequestAnimationFrame#isRAF
|
||||
* @return {boolean}
|
||||
*/
|
||||
isRAF: function () {
|
||||
return (this._isSetTimeOut === false);
|
||||
}
|
||||
|
||||
};</pre>
|
||||
</article>
|
||||
@@ -561,7 +598,7 @@ Phaser.RequestAnimationFrame.prototype = {
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||
on Thu Nov 07 2013 06:07:33 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user