Added in jsdocs

This commit is contained in:
Richard Davey 2018-01-31 13:54:44 +00:00
parent f73d66a246
commit 2a86400a28
52 changed files with 254 additions and 97 deletions

View file

@ -1,4 +1,6 @@
// Phaser.Animations /**
* @namespace Phaser.Animations
*/
module.exports = { module.exports = {

13
src/boot/index.js Normal file
View file

@ -0,0 +1,13 @@
/**
* @namespace Phaser.Boot
*/
module.exports = {
Config: require('./Config'),
CreateRenderer: require('./CreateRenderer'),
DebugHeader: require('./DebugHeader'),
TimeStep: require('./TimeStep'),
VisibilityHandler: require('./VisibilityHandler')
};

4
src/cache/index.js vendored
View file

@ -1,4 +1,6 @@
// Phaser.Cache /**
* @namespace Phaser.Cache
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Cameras.Scene2D /**
* @namespace Phaser.Cameras.Scene2D
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Cameras.Controls /**
* @namespace Phaser.Cameras.Controls
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Cameras /**
* @namespace Phaser.Cameras
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Cameras.Sprite3D /**
* @namespace Phaser.Cameras.Sprite3D
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Create /**
* @namespace Phaser.Create
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Curves /**
* @namespace Phaser.Curves
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Data /**
* @namespace Phaser.Data
*/
module.exports = { module.exports = {

View file

@ -3,7 +3,9 @@
// Which means all instances of Phaser Games can share it, // Which means all instances of Phaser Games can share it,
// without having to re-poll the device all over again // without having to re-poll the device all over again
// Phaser.Device /**
* @namespace Phaser.Device
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Display.Align.In /**
* @namespace Phaser.Display.Align.In
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Display.Align /**
* @namespace Phaser.Display.Align
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Display.Align.To /**
* @namespace Phaser.Display.Align.To
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Display.Bounds /**
* @namespace Phaser.Display.Bounds
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Display.Canvas /**
* @namespace Phaser.Display.Canvas
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Display.Color /**
* @namespace Phaser.Display.Color
*/
var Color = require('./Color'); var Color = require('./Color');

View file

@ -1,4 +1,6 @@
// Phaser.Display /**
* @namespace Phaser.Display
*/
module.exports = { module.exports = {

View file

@ -1,3 +1,6 @@
/**
* @namespace Phaser.Display.Masks
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.DOM /**
* @namespace Phaser.DOM
*/
module.exports = { module.exports = {

View file

@ -2,6 +2,10 @@ var Class = require('../utils/Class');
var EE = require('eventemitter3'); var EE = require('eventemitter3');
var PluginManager = require('../plugins/PluginManager'); var PluginManager = require('../plugins/PluginManager');
/**
* @namespace Phaser.Events
*/
var EventEmitter = new Class({ var EventEmitter = new Class({
Extends: EE, Extends: EE,

View file

@ -3,24 +3,25 @@ var Components = require('./components');
var DataManager = require('../data/DataManager'); var DataManager = require('../data/DataManager');
var EventEmitter = require('eventemitter3'); var EventEmitter = require('eventemitter3');
/**
* The base class that all Game Objects extend.
* You don't create GameObjects directly and they cannot be added to the display list.
* Instead, use them as the base for your own custom classes.
*
* @class GameObject
* @memberOf Phaser.GameObjects
* @constructor
* @since 3.0.0
*
* @param {Phaser.Scene} scene - The Scene to which this Game Object belongs.
* @param {string} type - A textual representation of the type of Game Object, i.e. `sprite`.
*/
var GameObject = new Class({ var GameObject = new Class({
Extends: EventEmitter, Extends: EventEmitter,
initialize: initialize:
/**
* The base class that all Game Objects extend.
* You don't create GameObjects directly and they cannot be added to the display list.
* Instead, use them as the base for your own custom classes.
*
* @class GameObject
* @memberof Phaser.GameObjects
* @constructor
*
* @param {Phaser.Scene} scene - The Scene to which this Game Object belongs.
* @param {string} type - A textual representation of the type of Game Object, i.e. `sprite`.
*/
function GameObject (scene, type) function GameObject (scene, type)
{ {
EventEmitter.call(this); EventEmitter.call(this);
@ -31,6 +32,7 @@ var GameObject = new Class({
* *
* @property {Phaser.Scene} scene * @property {Phaser.Scene} scene
* @protected * @protected
* @since 3.0.0
*/ */
this.scene = scene; this.scene = scene;
@ -39,6 +41,7 @@ var GameObject = new Class({
* Used internally by Phaser but is available for your own custom classes to populate. * Used internally by Phaser but is available for your own custom classes to populate.
* *
* @property {string} type * @property {string} type
* @since 3.0.0
*/ */
this.type = type; this.type = type;
@ -47,6 +50,7 @@ var GameObject = new Class({
* Empty by default and never populated by Phaser, this is left for developers to use. * Empty by default and never populated by Phaser, this is left for developers to use.
* *
* @property {string} [name=''] * @property {string} [name='']
* @since 3.0.0
*/ */
this.name = ''; this.name = '';
@ -56,6 +60,7 @@ var GameObject = new Class({
* An active object is one which is having its logic and internal systems updated. * An active object is one which is having its logic and internal systems updated.
* *
* @property {boolean} [active=true] * @property {boolean} [active=true]
* @since 3.0.0
*/ */
this.active = true; this.active = true;
@ -64,6 +69,7 @@ var GameObject = new Class({
* Reserved for future use by plugins and the Input Manager. * Reserved for future use by plugins and the Input Manager.
* *
* @property {integer} [tabIndex=-1] * @property {integer} [tabIndex=-1]
* @since 3.0.0
*/ */
this.tabIndex = -1; this.tabIndex = -1;
@ -73,6 +79,7 @@ var GameObject = new Class({
* `null` by default. Automatically created if you use `getData` or `setData` or `setDataEnabled`. * `null` by default. Automatically created if you use `getData` or `setData` or `setDataEnabled`.
* *
* @property {Phaser.Data.DataManager} data * @property {Phaser.Data.DataManager} data
* @since 3.0.0
*/ */
this.data = null; this.data = null;
@ -82,6 +89,7 @@ var GameObject = new Class({
* If those components are not used by your custom class then you can use this bitmask as you wish. * If those components are not used by your custom class then you can use this bitmask as you wish.
* *
* @property {integer} [renderFlags=15] * @property {integer} [renderFlags=15]
* @since 3.0.0
*/ */
this.renderFlags = 15; this.renderFlags = 15;
@ -91,6 +99,7 @@ var GameObject = new Class({
* *
* @property {number} [cameraFilter=0] * @property {number} [cameraFilter=0]
* @see Phaser.Cameras.Camera.ignore * @see Phaser.Cameras.Camera.ignore
* @since 3.0.0
*/ */
this.cameraFilter = 0; this.cameraFilter = 0;
@ -100,6 +109,7 @@ var GameObject = new Class({
* *
* @property {?Phaser.Input.InteractiveObject} [input=null] * @property {?Phaser.Input.InteractiveObject} [input=null]
* @see setInteractive * @see setInteractive
* @since 3.0.0
*/ */
this.input = null; this.input = null;
@ -107,6 +117,7 @@ var GameObject = new Class({
* If this Game Object is enabled for physics then this property will contain a reference to a Physics Body. * If this Game Object is enabled for physics then this property will contain a reference to a Physics Body.
* *
* @property {?Phaser.Physics.Body} [body=null] * @property {?Phaser.Physics.Body} [body=null]
* @since 3.0.0
*/ */
this.body = null; this.body = null;
@ -118,10 +129,12 @@ var GameObject = new Class({
* Sets the `active` property of this Game Object and returns this Game Object for further chaining. * Sets the `active` property of this Game Object and returns this Game Object for further chaining.
* A Game Object with its `active` property set to `true` will be updated by the Scenes UpdateList. * A Game Object with its `active` property set to `true` will be updated by the Scenes UpdateList.
* *
* @method setActive * @method Phaser.GameObjects.GameObject#setActive
* @since 3.0.0
* *
* @param {boolean} value - True if this Game Object should be set as active, false if not. * @param {boolean} value - True if this Game Object should be set as active, false if not.
* @return {GameObject} This GameObject. *
* @return {Phaser.GameObjects.GameObject} This GameObject.
*/ */
setActive: function (value) setActive: function (value)
{ {
@ -134,13 +147,12 @@ var GameObject = new Class({
* Sets the `name` property of this Game Object and returns this Game Object for further chaining. * Sets the `name` property of this Game Object and returns this Game Object for further chaining.
* The `name` property is not populated by Phaser and is presented for your own use. * The `name` property is not populated by Phaser and is presented for your own use.
* *
* @example game objects/image/set name.js * @method Phaser.GameObjects.GameObject#setName
* @tutorial game objects/basics * @since 3.0.0
*
* @method setName
* *
* @param {string} value - The name to be given to this Game Object. * @param {string} value - The name to be given to this Game Object.
* @return {GameObject} This GameObject. *
* @return {Phaser.GameObjects.GameObject} This GameObject.
*/ */
setName: function (value) setName: function (value)
{ {
@ -149,6 +161,14 @@ var GameObject = new Class({
return this; return this;
}, },
/**
* [description]
*
* @method Phaser.GameObjects.GameObject#setDataEnabled
* @since 3.0.0
*
* @return {Phaser.GameObjects.GameObject} This GameObject.
*/
setDataEnabled: function () setDataEnabled: function ()
{ {
if (!this.data) if (!this.data)
@ -163,11 +183,13 @@ var GameObject = new Class({
* This is a quick chainable alias to the `DataProxy.set` method. * This is a quick chainable alias to the `DataProxy.set` method.
* It allows you to set a key and value in this Game Objects data store. * It allows you to set a key and value in this Game Objects data store.
* *
* @method setData * @method Phaser.GameObjects.GameObject#setData
* @since 3.0.0
* *
* @param {string} key - The key of the property to be stored. * @param {string} key - The key of the property to be stored.
* @param {any} value - The value to store with the key. Can be a string, number, array or object. * @param {any} value - The value to store with the key. Can be a string, number, array or object.
* @return {GameObject} This GameObject. *
* @return {Phaser.GameObjects.GameObject} This GameObject.
*/ */
setData: function (key, value) setData: function (key, value)
{ {
@ -184,9 +206,11 @@ var GameObject = new Class({
/** /**
* This is a quick alias to the `DataProxy.get` method to remain consistent with `setData`. * This is a quick alias to the `DataProxy.get` method to remain consistent with `setData`.
* *
* @method getData * @method Phaser.GameObjects.GameObject#getData
* @since 3.0.0
* *
* @param {string} key - The key of the property to be retrieve. * @param {string} key - The key of the property to be retrieved.
*
* @return {any} The data, if present in the Data Store. * @return {any} The data, if present in the Data Store.
*/ */
getData: function (key) getData: function (key)
@ -202,14 +226,13 @@ var GameObject = new Class({
/** /**
* Pass this Game Object to the Input Manager to enable it for Input. * Pass this Game Object to the Input Manager to enable it for Input.
* *
* @example game objects/image/set interactive.js * @method Phaser.GameObjects.GameObject#setInteractive
* @tutorial input/basics * @since 3.0.0
*
* @method setInteractive
* *
* @param {any} [shape] - A geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. * @param {any} [shape] - A geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used.
* @param {function} [callback] - A callback to be invoked when the Game Object is interacted with. * @param {function} [callback] - A callback to be invoked when the Game Object is interacted with.
* @return {GameObject} This GameObject. *
* @return {Phaser.GameObjects.GameObject} This GameObject.
*/ */
setInteractive: function (shape, callback) setInteractive: function (shape, callback)
{ {
@ -218,7 +241,12 @@ var GameObject = new Class({
return this; return this;
}, },
// To be overridden by custom GameObjects. Allows base objects to be used in a Pool. /**
* To be overridden by custom GameObjects. Allows base objects to be used in a Pool.
*
* @method Phaser.GameObjects.GameObject#update
* @since 3.0.0
*/
update: function () update: function ()
{ {
}, },
@ -226,7 +254,8 @@ var GameObject = new Class({
/** /**
* Returns a JSON representation of the Game Object. * Returns a JSON representation of the Game Object.
* *
* @method toJSON * @method Phaser.GameObjects.GameObject#toJSON
* @since 3.0.0
* *
* @return {object} A JSON representation of the Game Object. * @return {object} A JSON representation of the Game Object.
*/ */
@ -238,7 +267,8 @@ var GameObject = new Class({
/** /**
* Compares the renderMask with the renderFlags to see if this Game Object will render or not. * Compares the renderMask with the renderFlags to see if this Game Object will render or not.
* *
* @method willRender * @method Phaser.GameObjects.GameObject#willRender
* @since 3.0.0
* *
* @return {boolean} True if the Game Object should be rendered, otherwise false. * @return {boolean} True if the Game Object should be rendered, otherwise false.
*/ */
@ -260,7 +290,8 @@ var GameObject = new Class({
* If you just want to temporarily disable an object then look at using the * If you just want to temporarily disable an object then look at using the
* Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected. * Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected.
* *
* @method destroy * @method Phaser.GameObjects.GameObject#destroy
* @since 3.0.0
*/ */
destroy: function () destroy: function ()
{ {

View file

@ -6,6 +6,28 @@ var DisplayList = require('../DisplayList');
var Frame = require('../../textures/Frame'); var Frame = require('../../textures/Frame');
var GameObject = require('../GameObject'); var GameObject = require('../GameObject');
/**
* A Blitter Game Object.
*
* The Blitter Game Object is a special type of Container, that contains Blitter.Bob objects.
* These objects can be thought of as just texture frames with a position and nothing more.
* Bobs don't have any update methods, or the ability to have children, or any kind of special effects.
* They are essentially just super-fast texture frame renderers, and the Blitter object creates and manages them.
*
* @class Blitter
* @extends Phaser.GameObjects.GameObject
* @memberOf Phaser.GameObjects
* @constructor
* @since 3.0.0
*
* @mixes Phaser.GameObjects.Components.Alpha
*
* @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time.
* @param {number} [x==] - The x coordinate of this Game Object in world space.
* @param {number} [y=0] - The y coordinate of this Game Object in world space.
* @param {string} [texture='__DEFAULT'] - The key of the texture this Game Object will use for rendering. The Texture must already exist in the Texture Manager.
* @param {string|integer} [frame=0] - The Frame of the Texture that this Game Object will use. Only set if the Texture has multiple frames, such as a Texture Atlas or Sprite Sheet.
*/
var Blitter = new Class({ var Blitter = new Class({
Extends: GameObject, Extends: GameObject,
@ -25,28 +47,6 @@ var Blitter = new Class({
initialize: initialize:
/**
* A Blitter Game Object.
*
* The Blitter Game Object is a special type of Container, that contains Blitter.Bob objects.
* These objects can be thought of as just texture frames with a position and nothing more.
* Bobs don't have any update methods, or the ability to have children, or any kind of special effects.
* They are essentially just super-fast texture frame renderers, and the Blitter object creates and manages them.
*
* @class Blitter
* @extends Phaser.GameObjects.GameObject
* @memberOf Phaser.GameObjects
* @constructor
* @since 3.0.0
*
* @mixes Phaser.GameObjects.Components.Alpha
*
* @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time.
* @param {number} [x==] - The x coordinate of this Game Object in world space.
* @param {number} [y=0] - The y coordinate of this Game Object in world space.
* @param {string} [texture='__DEFAULT'] - The key of the texture this Game Object will use for rendering. The Texture must already exist in the Texture Manager.
* @param {string|integer} [frame=0] - The Frame of the Texture that this Game Object will use. Only set if the Texture has multiple frames, such as a Texture Atlas or Sprite Sheet.
*/
function Blitter (scene, x, y, texture, frame) function Blitter (scene, x, y, texture, frame)
{ {
GameObject.call(this, scene, 'Blitter'); GameObject.call(this, scene, 'Blitter');

View file

@ -1,4 +1,6 @@
// Phaser.GameObjects /**
* @namespace Phaser.GameObjects
*/
var GameObjects = { var GameObjects = {

View file

@ -1,4 +1,6 @@
// Phaser.Geom.Circle /**
* @namespace Phaser.Geom.Circle
*/
var Circle = require('./Circle'); var Circle = require('./Circle');

View file

@ -1,4 +1,6 @@
// Phaser.Geom.Ellipse /**
* @namespace Phaser.Geom.Ellipse
*/
var Ellipse = require('./Ellipse'); var Ellipse = require('./Ellipse');

View file

@ -1,4 +1,6 @@
// Phaser.Geom /**
* @namespace Phaser.Geom
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Geom.Intersects /**
* @namespace Phaser.Geom.Intersects
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Geom.Line /**
* @namespace Phaser.Geom.Line
*/
var Line = require('./Line'); var Line = require('./Line');

View file

@ -1,4 +1,6 @@
// Phaser.Geom.Point /**
* @namespace Phaser.Geom.Point
*/
var Point = require('./Point'); var Point = require('./Point');

View file

@ -1,4 +1,6 @@
// Phaser.Geom.Polygon /**
* @namespace Phaser.Geom.Polygon
*/
var Polygon = require('./Polygon'); var Polygon = require('./Polygon');

View file

@ -1,4 +1,6 @@
// Phaser.Geom.Rectangle /**
* @namespace Phaser.Geom.Rectangle
*/
var Rectangle = require('./Rectangle'); var Rectangle = require('./Rectangle');

View file

@ -1,4 +1,6 @@
// Phaser.Geom.Triangle /**
* @namespace Phaser.Geom.Triangle
*/
var Triangle = require('./Triangle'); var Triangle = require('./Triangle');

View file

@ -1,4 +1,6 @@
// Phaser.Input.Gamepad /**
* @namespace Phaser.Input.Gamepad
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Input /**
* @namespace Phaser.Input
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Input.Keyboard /**
* @namespace Phaser.Input.Keyboard
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Input.Mouse /**
* @namespace Phaser.Input.Mouse
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Input.Touch /**
* @namespace Phaser.Input.Touch
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,10 @@
// Phaser.Loader /**
* @namespace Phaser.Loader
*/
/**
* @namespace Phaser.Loader.FileTypes
*/
module.exports = { module.exports = {

View file

@ -1,5 +1,9 @@
var RND = require('./random-data-generator/RandomDataGenerator'); var RND = require('./random-data-generator/RandomDataGenerator');
/**
* @namespace Phaser.Math
*/
module.exports = { module.exports = {
// Consts // Consts

View file

@ -3,7 +3,9 @@ require('./polyfills');
var CONST = require('./const'); var CONST = require('./const');
var Extend = require('./utils/object/Extend'); var Extend = require('./utils/object/Extend');
// This object is exported globally /**
* @namespace Phaser
*/
var Phaser = { var Phaser = {

View file

@ -1,4 +1,6 @@
// Phaser.Physics /**
* @namespace Phaser.Physics
*/
module.exports = { module.exports = {

View file

@ -2,6 +2,10 @@ var Class = require('../utils/Class');
var plugins = {}; var plugins = {};
/**
* @namespace Phaser.Plugins
*/
var PluginManager = new Class({ var PluginManager = new Class({
initialize: initialize:

View file

@ -7,6 +7,10 @@ var GetBlendModes = require('./utils/GetBlendModes');
var ScaleModes = require('../ScaleModes'); var ScaleModes = require('../ScaleModes');
var Smoothing = require('../../display/canvas/Smoothing'); var Smoothing = require('../../display/canvas/Smoothing');
/**
* @namespace Phaser.Renderer.CanvasRenderer
*/
var CanvasRenderer = new Class({ var CanvasRenderer = new Class({
initialize: initialize:

View file

@ -10,6 +10,10 @@ var FlatTintPipeline = require('./pipelines/FlatTintPipeline');
var BitmapMaskPipeline = require('./pipelines/BitmapMaskPipeline'); var BitmapMaskPipeline = require('./pipelines/BitmapMaskPipeline');
var ForwardDiffuseLightPipeline = require('./pipelines/ForwardDiffuseLightPipeline'); var ForwardDiffuseLightPipeline = require('./pipelines/ForwardDiffuseLightPipeline');
/**
* @namespace Phaser.Renderer.WebGLRenderer
*/
var WebGLRenderer = new Class({ var WebGLRenderer = new Class({
initialize: initialize:

View file

@ -1,4 +1,6 @@
// Phaser.Scenes /**
* @namespace Phaser.Scenes
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Sound /**
* @namespace Phaser.Sound
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Structs /**
* @namespace Phaser.Structs
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Textures /**
* @namespace Phaser.Textures
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Time /**
* @namespace Phaser.Time
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Tweens /**
* @namespace Phaser.Tweens
*/
module.exports = { module.exports = {

View file

@ -1,4 +1,6 @@
// Phaser.Utils /**
* @namespace Phaser.Utils
*/
module.exports = { module.exports = {