diff --git a/src/actions/Call.js b/src/actions/Call.js index 9bcaa9d5d..51cefe150 100644 --- a/src/actions/Call.js +++ b/src/actions/Call.js @@ -18,7 +18,7 @@ * * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {CallCallback} callback - The callback to be invoked. It will be passed just one argument: the item from the array. - * @param {object} context - The scope in which the callback will be invoked. + * @param {*} context - The scope in which the callback will be invoked. * * @return {array} The array of objects that was passed to this Action. */ diff --git a/src/actions/GetFirst.js b/src/actions/GetFirst.js index eedfd513f..3e280d783 100644 --- a/src/actions/GetFirst.js +++ b/src/actions/GetFirst.js @@ -18,7 +18,7 @@ * @param {object} compare - The comparison object. Each property in this object will be checked against the items of the array. * @param {integer} [index=0] - An optional offset to start searching from within the items array. * - * @return {object} The first object in the array that matches the comparison object, or `null` if no match was found. + * @return {?(object|Phaser.GameObjects.GameObject)} The first object in the array that matches the comparison object, or `null` if no match was found. */ var GetFirst = function (items, compare, index) { diff --git a/src/actions/GetLast.js b/src/actions/GetLast.js index f8b52ae7f..00fa124ba 100644 --- a/src/actions/GetLast.js +++ b/src/actions/GetLast.js @@ -18,7 +18,7 @@ * @param {object} compare - The comparison object. Each property in this object will be checked against the items of the array. * @param {integer} [index=0] - An optional offset to start searching from within the items array. * - * @return {object} The last object in the array that matches the comparison object, or `null` if no match was found. + * @return {?(object|Phaser.GameObjects.GameObject)} The last object in the array that matches the comparison object, or `null` if no match was found. */ var GetLast = function (items, compare, index) { diff --git a/src/cameras/2d/Camera.js b/src/cameras/2d/Camera.js index 5c1b2b18d..7f1ef6ae9 100644 --- a/src/cameras/2d/Camera.js +++ b/src/cameras/2d/Camera.js @@ -25,7 +25,11 @@ var Vector2 = require('../../math/Vector2'); * @property {number} scrollX - The horizontal scroll of camera * @property {number} scrollY - The vertical scroll of camera * @property {string} backgroundColor - The background color of camera - * @property {object} [bounds] - The bounds of camera // TODO 19/03/2018 Create BoundsObject ({x:number,y:number,width:number,height:number}) + * @property {object} [bounds] - The bounds of camera + * @property {number} [bounds.x] - The horizontal position of bounds of camera + * @property {number} [bounds.y] - The vertical position of bounds of camera + * @property {number} [bounds.width] - The width of the bounds of camera + * @property {number} [bounds.height] - The height of the bounds of camera */ /** diff --git a/src/cameras/sprite3d/Camera.js b/src/cameras/sprite3d/Camera.js index d48bef998..76e322c7b 100644 --- a/src/cameras/sprite3d/Camera.js +++ b/src/cameras/sprite3d/Camera.js @@ -24,6 +24,13 @@ var billboardMatrix = new Matrix4(); // @author attribute https://github.com/mattdesl/cam3d/wiki +/** + * @typedef {object} RayDef + * + * @property {Phaser.Math.Vector3} origin - [description] + * @property {Phaser.Math.Vector3} direction - [description] + */ + /** * @classdesc * [description] @@ -174,13 +181,6 @@ var Camera = new Class({ */ this.far = 100; - /** - * @typedef {object} RayDef - * - * @property {Phaser.Math.Vector3} origin - [description] - * @property {Phaser.Math.Vector3} direction - [description] - */ - /** * [description] * diff --git a/src/gameobjects/BuildGameObject.js b/src/gameobjects/BuildGameObject.js index a1300cb09..f99a932b2 100644 --- a/src/gameobjects/BuildGameObject.js +++ b/src/gameobjects/BuildGameObject.js @@ -8,6 +8,26 @@ var BlendModes = require('../renderer/BlendModes'); var GetAdvancedValue = require('../utils/object/GetAdvancedValue'); var ScaleModes = require('../renderer/ScaleModes'); +/** + * @typedef {object} GameObjectConfig + * + * @property {number} [x=0] - [description] + * @property {number} [y=0] - [description] + * @property {number} [depth=0] - [description] + * @property {boolean} [flipX=false] - [description] + * @property {boolean} [flipY=false] - [description] + * @property {?(number|object)} [scale=null] - [description] + * @property {?(number|object)} [scrollFactor=null] - [description] + * @property {number} [rotation=0] - [description] + * @property {?number} [angle=null] - [description] + * @property {number} [alpha=1] - [description] + * @property {?(number|object)} [origin=null] - [description] + * @property {number} [scaleMode=ScaleModes.DEFAULT] - [description] + * @property {number} [blendMode=BlendModes.DEFAULT] - [description] + * @property {boolean} [visible=true] - [description] + * @property {boolean} [add=true] - [description] + */ + /** * Builds a Game Object using the provided configuration object. * @@ -16,7 +36,7 @@ var ScaleModes = require('../renderer/ScaleModes'); * * @param {Phaser.Scene} scene - [description] * @param {Phaser.GameObjects.GameObject} gameObject - [description] - * @param {object} config - [description] + * @param {GameObjectConfig} config - [description] * * @return {Phaser.GameObjects.GameObject} The built Game Object. */ diff --git a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js index db2aa9227..101241442 100644 --- a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js +++ b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js @@ -125,7 +125,7 @@ var DynamicBitmapText = new Class({ * [description] * * @name Phaser.GameObjects.DynamicBitmapText#_bounds - * @type {object} + * @type {TextBounds} * @private * @since 3.0.0 */ @@ -360,7 +360,7 @@ var DynamicBitmapText = new Class({ * @method Phaser.GameObjects.DynamicBitmapText#toJSON * @since 3.0.0 * - * @return {object} [description] + * @return {JSONGameObject.} [description] */ toJSON: function () { diff --git a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextCreator.js b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextCreator.js index 4bd86665b..05f83e4ba 100644 --- a/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextCreator.js +++ b/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextCreator.js @@ -9,6 +9,16 @@ var BuildGameObject = require('../../BuildGameObject'); var GameObjectCreator = require('../../GameObjectCreator'); var GetAdvancedValue = require('../../../utils/object/GetAdvancedValue'); +/** + * @typedef {object} BitmapTextConfig + * @extends GameObjectConfig + * + * @property {string} [font=''] - [description] + * @property {string} [text=''] - [description] + * @property {(number|false)} [size=false] - [description] + * @property {string} [align=''] - [description] + */ + /** * Creates a new Dynamic Bitmap Text Game Object and returns it. * @@ -16,8 +26,8 @@ var GetAdvancedValue = require('../../../utils/object/GetAdvancedValue'); * * @method Phaser.GameObjects.GameObjectCreator#dynamicBitmapText * @since 3.0.0 - * - * @param {object} config - [description] + *² + * @param {BitmapTextConfig} config - [description] * * @return {Phaser.GameObjects.DynamicBitmapText} The Game Object that was created. */ diff --git a/src/gameobjects/bitmaptext/static/BitmapText.js b/src/gameobjects/bitmaptext/static/BitmapText.js index 174ef4929..24990e3a1 100644 --- a/src/gameobjects/bitmaptext/static/BitmapText.js +++ b/src/gameobjects/bitmaptext/static/BitmapText.js @@ -15,16 +15,24 @@ var Render = require('./BitmapTextRender'); /** * @typedef {object} TextBounds * - * @param {object} local - [description] - * @param {number} local.x - [description] - * @param {number} local.y - [description] - * @param {number} local.width - [description] - * @param {number} local.height - [description] - * @param {object} global - [description] - * @param {number} global.x - [description] - * @param {number} global.y - [description] - * @param {number} global.width - [description] - * @param {number} global.height - [description] + * @property {object} local - [description] + * @property {number} local.x - [description] + * @property {number} local.y - [description] + * @property {number} local.width - [description] + * @property {number} local.height - [description] + * @property {object} global - [description] + * @property {number} global.x - [description] + * @property {number} global.y - [description] + * @property {number} global.width - [description] + * @property {number} global.height - [description] + */ + +/** + * @typedef {object} JSONBitmapText + * + * @property {string} font - [description] + * @property {string} text - [description] + * @property {number} fontSize - [description] */ /** @@ -130,7 +138,7 @@ var BitmapText = new Class({ * [description] * * @name Phaser.GameObjects.BitmapText#_bounds - * @type {object} + * @type {TextBounds} * @private * @since 3.0.0 */ @@ -248,7 +256,7 @@ var BitmapText = new Class({ * @method Phaser.GameObjects.BitmapText#toJSON * @since 3.0.0 * - * @return {JSONGameObject} [description] + * @return {JSONGameObject.} [description] */ toJSON: function () { diff --git a/src/gameobjects/bitmaptext/static/BitmapTextCreator.js b/src/gameobjects/bitmaptext/static/BitmapTextCreator.js index 4bc8b349c..207736be6 100644 --- a/src/gameobjects/bitmaptext/static/BitmapTextCreator.js +++ b/src/gameobjects/bitmaptext/static/BitmapTextCreator.js @@ -18,7 +18,7 @@ var GetValue = require('../../../utils/object/GetValue'); * @method Phaser.GameObjects.GameObjectCreator#bitmapText * @since 3.0.0 * - * @param {object} config - [description] + * @param {BitmapTextConfig} config - [description] * * @return {Phaser.GameObjects.BitmapText} The Game Object that was created. */ diff --git a/src/gameobjects/components/ToJSON.js b/src/gameobjects/components/ToJSON.js index a8f364b8a..460e302db 100644 --- a/src/gameobjects/components/ToJSON.js +++ b/src/gameobjects/components/ToJSON.js @@ -6,6 +6,7 @@ /** * @typedef {object} JSONGameObject + * @template DATA * * @property {string} name - The name of this Game Object. * @property {string} type - A textual representation of this Game Object, i.e. `sprite`. @@ -26,7 +27,7 @@ * @property {(integer|string)} blendMode - Sets the Blend Mode being used by this Game Object. * @property {string} textureKey - The texture key of this Game Object. * @property {string} frameKey - The frame key of this Game Object. - * @property {object} data - The data of this Game Object. + * @property {DATA} data - The data of this Game Object. */ // Default Game Object JSON export diff --git a/src/gameobjects/components/Transform.js b/src/gameobjects/components/Transform.js index 7d5d3da50..06f4e0970 100644 --- a/src/gameobjects/components/Transform.js +++ b/src/gameobjects/components/Transform.js @@ -13,7 +13,7 @@ var _FLAG = 4; // 0100 /** * Provides methods used for getting and setting the position, scale and rotation of a Game Object. - * + * * @name Phaser.GameObjects.Components.Transform * @since 3.0.0 */ @@ -27,7 +27,7 @@ var Transform = { /** * The x position of this Game Object. - * + * * @name Phaser.GameObjects.Components.Transform#x * @type {number} * @default 0 @@ -37,7 +37,7 @@ var Transform = { /** * The y position of this Game Object. - * + * * @name Phaser.GameObjects.Components.Transform#y * @type {number} * @default 0 @@ -48,7 +48,7 @@ var Transform = { /** * The z position of this Game Object. * Note: Do not use this value to set the z-index, instead see the `depth` property. - * + * * @name Phaser.GameObjects.Components.Transform#z * @type {number} * @default 0 @@ -58,7 +58,7 @@ var Transform = { /** * The w position of this Game Object. - * + * * @name Phaser.GameObjects.Components.Transform#w * @type {number} * @default 0 @@ -68,7 +68,7 @@ var Transform = { /** * The horizontal scale of this Game Object. - * + * * @name Phaser.GameObjects.Components.Transform#scaleX * @type {number} * @default 1 @@ -99,7 +99,7 @@ var Transform = { /** * The vertical scale of this Game Object. - * + * * @name Phaser.GameObjects.Components.Transform#scaleY * @type {number} * @default 1 @@ -130,11 +130,11 @@ var Transform = { /** * The angle of this Game Object as expressed in degrees. - * + * * Where 0 is to the right, 90 is down, 180 is left. - * + * * If you prefer to work in radians, see the `rotation` property instead. - * + * * @name Phaser.GameObjects.Components.Transform#angle * @type {integer} * @default 0 @@ -156,9 +156,9 @@ var Transform = { /** * The angle of this Game Object in radians. - * + * * If you prefer to work in degrees, see the `angle` property instead. - * + * * @name Phaser.GameObjects.Components.Transform#rotation * @type {number} * @default 1 @@ -180,7 +180,7 @@ var Transform = { /** * Sets the position of this Game Object. - * + * * @method Phaser.GameObjects.Components.Transform#setPosition * @since 3.0.0 * @@ -188,7 +188,7 @@ var Transform = { * @param {number} [y] - The y position of this Game Object. If not set it will use the `x` value. * @param {number} [z=0] - The z position of this Game Object. * @param {number} [w=0] - The w position of this Game Object. - * + * * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ setPosition: function (x, y, z, w) @@ -208,12 +208,12 @@ var Transform = { /** * Sets the rotation of this Game Object. - * + * * @method Phaser.GameObjects.Components.Transform#setRotation * @since 3.0.0 * * @param {number} [radians=0] - The rotation of this Game Object, in radians. - * + * * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ setRotation: function (radians) @@ -227,12 +227,12 @@ var Transform = { /** * Sets the angle of this Game Object. - * + * * @method Phaser.GameObjects.Components.Transform#setAngle * @since 3.0.0 * * @param {number} [degrees=0] - The rotation of this Game Object, in degrees. - * + * * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ setAngle: function (degrees) @@ -246,13 +246,13 @@ var Transform = { /** * Sets the scale of this Game Object. - * + * * @method Phaser.GameObjects.Components.Transform#setScale * @since 3.0.0 * * @param {number} x - The horizontal scale of this Game Object. - * @param {number} [y] - The vertical scale of this Game Object. If not set it will use the `x` value. - * + * @param {number} [y=x] - The vertical scale of this Game Object. If not set it will use the `x` value. + * * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ setScale: function (x, y) @@ -268,12 +268,12 @@ var Transform = { /** * Sets the x position of this Game Object. - * + * * @method Phaser.GameObjects.Components.Transform#setX * @since 3.0.0 * * @param {number} [value=0] - The x position of this Game Object. - * + * * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ setX: function (value) @@ -287,12 +287,12 @@ var Transform = { /** * Sets the y position of this Game Object. - * + * * @method Phaser.GameObjects.Components.Transform#setY * @since 3.0.0 * * @param {number} [value=0] - The y position of this Game Object. - * + * * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ setY: function (value) @@ -306,12 +306,12 @@ var Transform = { /** * Sets the z position of this Game Object. - * + * * @method Phaser.GameObjects.Components.Transform#setZ * @since 3.0.0 * * @param {number} [value=0] - The z position of this Game Object. - * + * * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ setZ: function (value) @@ -325,12 +325,12 @@ var Transform = { /** * Sets the w position of this Game Object. - * + * * @method Phaser.GameObjects.Components.Transform#setW * @since 3.0.0 * * @param {number} [value=0] - The w position of this Game Object. - * + * * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ setW: function (value) diff --git a/src/gameobjects/group/Group.js b/src/gameobjects/group/Group.js index 24bf2b586..65cd6f94f 100644 --- a/src/gameobjects/group/Group.js +++ b/src/gameobjects/group/Group.js @@ -12,6 +12,67 @@ var Range = require('../../utils/array/Range'); var Set = require('../../structs/Set'); var Sprite = require('../sprite/Sprite'); +/** + * @callback GroupCallback + * + * @param {Phaser.GameObjects.GameObject} item - [description] + */ + +/** + * @callback GroupMultipleCreateCallback + * + * @param {Phaser.GameObjects.GameObject[]} items - [description] + */ + +/** + * @typedef {object} GroupConfig + * + * @property {object} [classType=Sprite] - [description] + * @property {boolean} [active=true] - [description] + * @property {number} [maxSize=-1] - [description] + * @property {?string} [defaultKey=null] - [description] + * @property {?(string|integer)} [defaultFrame=null] - [description] + * @property {boolean} [runChildUpdate=false] - [description] + * @property {?GroupCallback} [createCallback=null] - [description] + * @property {?GroupCallback} [removeCallback=null] - [description] + * @property {?GroupMultipleCreateCallback} [createMultipleCallback=null] - [description] + */ + +/** + * @typedef {object} GroupCreateConfig + * + * @property {object} [classType] - [description] + * @property {string} [key] - [description] + * @property {?(string|integer)} [frame=null] - [description] + * @property {boolean} [visible=true] - [description] + * @property {boolean} [active=true] - [description] + * @property {number} [repeat=0] - [description] + * @property {boolean} [randomKey=false] - [description] + * @property {boolean} [randomFrame=false] - [description] + * @property {boolean} [yoyo=false] - [description] + * @property {number} [frameQuantity=1] - [description] + * @property {number} [max=1] - [description] + * @property {object} [setXY] - [description] + * @property {number} [setXY.x=0] - [description] + * @property {number} [setXY.y=0] - [description] + * @property {number} [setXY.stepX=0] - [description] + * @property {number} [setXY.stepY=0] - [description] + * @property {object} [setRotation] - [description] + * @property {number} [setRotation.value=0] - [description] + * @property {number} [setRotation.step=0] - [description] + * @property {object} [setScale] - [description] + * @property {number} [setScale.x=0] - [description] + * @property {number} [setScale.y=0] - [description] + * @property {number} [setScale.stepX=0] - [description] + * @property {number} [setScale.stepY=0] - [description] + * @property {object} [setAlpha] - [description] + * @property {number} [setAlpha.value=0] - [description] + * @property {number} [setAlpha.step=0] - [description] + * @property {*} [hitArea] - [description] + * @property {HitAreaCallback} [hitAreaCallback] - [description] + * @property {(false|GridAlignConfig)} [gridAlign=false] - [description] + */ + /** * @classdesc * [description] @@ -26,7 +87,7 @@ var Sprite = require('../sprite/Sprite'); * * @param {Phaser.Scene} scene - [description] * @param {array} children - [description] - * @param {object} config - [description] + * @param {GroupConfig} config - [description] */ var Group = new Class({ @@ -127,7 +188,7 @@ var Group = new Class({ * [description] * * @name Phaser.GameObjects.Group#createCallback - * @type {?function} + * @type {?GroupCallback} * @since 3.0.0 */ this.createCallback = GetFastValue(config, 'createCallback', null); @@ -136,7 +197,7 @@ var Group = new Class({ * [description] * * @name Phaser.GameObjects.Group#removeCallback - * @type {?function} + * @type {?GroupCallback} * @since 3.0.0 */ this.removeCallback = GetFastValue(config, 'removeCallback', null); @@ -145,7 +206,7 @@ var Group = new Class({ * [description] * * @name Phaser.GameObjects.Group#createMultipleCallback - * @type {?function} + * @type {?GroupMultipleCreateCallback} * @since 3.0.0 */ this.createMultipleCallback = GetFastValue(config, 'createMultipleCallback', null); @@ -208,7 +269,7 @@ var Group = new Class({ * @method Phaser.GameObjects.Group#createMultiple * @since 3.0.0 * - * @param {object} config - [description] + * @param {GroupCreateConfig} config - [description] * * @return {Phaser.GameObjects.GameObject[]} [description] */ @@ -237,7 +298,7 @@ var Group = new Class({ * @method Phaser.GameObjects.Group#createFromConfig * @since 3.0.0 * - * @param {object} options - [description] + * @param {GroupCreateConfig} options - [description] * * @return {Phaser.GameObjects.GameObject[]} [description] */ diff --git a/src/gameobjects/pathfollower/PathFollower.js b/src/gameobjects/pathfollower/PathFollower.js index c4e27b732..3f0fc49c5 100644 --- a/src/gameobjects/pathfollower/PathFollower.js +++ b/src/gameobjects/pathfollower/PathFollower.js @@ -12,6 +12,18 @@ var Sprite = require('../sprite/Sprite'); var TWEEN_CONST = require('../../tweens/tween/const'); var Vector2 = require('../../math/Vector2'); +/** + * @typedef {object} PathConfig + * + * @property {number} duration - [description] + * @property {number} from - [description] + * @property {number} to - [description] + * @property {boolean} [positionOnPath=false] - [description] + * @property {boolean} [rotateToPath=false] - [description] + * @property {number} [rotationOffset=0] - [description] + * @property {boolean} [verticalAdjust=false] - [description] + */ + /** * @classdesc * A PathFollower Game Object. @@ -112,7 +124,7 @@ var PathFollower = new Class({ * [description] * * @name Phaser.GameObjects.PathFollower#pathTween - * @type {null} + * @type {Phaser.Tweens.Tween} * @since 3.0.0 */ this.pathTween; @@ -121,7 +133,7 @@ var PathFollower = new Class({ * [description] * * @name Phaser.GameObjects.PathFollower#pathConfig - * @type {?object} + * @type {?PathConfig} * @default null * @since 3.0.0 */ @@ -145,7 +157,7 @@ var PathFollower = new Class({ * @since 3.0.0 * * @param {Phaser.Curves.Path} path - The Path this PathFollower is following. It can only follow one Path at a time. - * @param {object} config - [description] + * @param {PathConfig} [config] - [description] * * @return {Phaser.GameObjects.PathFollower} This Game Object. */ @@ -217,7 +229,7 @@ var PathFollower = new Class({ * @method Phaser.GameObjects.PathFollower#startFollow * @since 3.3.0 * - * @param {object} config - [description] + * @param {(number|PathConfig)} [config={}] - [description] * @param {number} [startAt=0] - [description] * * @return {Phaser.GameObjects.PathFollower} This Game Object. diff --git a/src/gameobjects/rendertexture/RenderTextureCreator.js b/src/gameobjects/rendertexture/RenderTextureCreator.js index 0ac72b046..466b560a4 100644 --- a/src/gameobjects/rendertexture/RenderTextureCreator.js +++ b/src/gameobjects/rendertexture/RenderTextureCreator.js @@ -9,6 +9,15 @@ var GameObjectCreator = require('../GameObjectCreator'); var GetAdvancedValue = require('../../utils/object/GetAdvancedValue'); var RenderTexture = require('./RenderTexture'); +/** + * @typedef {object} RenderTextureConfig + * + * @property {number} [x=0] - [description] + * @property {number} [y=0] - [description] + * @property {number} [width=32] - [description] + * @property {number} [height=32] - [description] + */ + /** * Creates a new Render Texture Game Object and returns it. * @@ -17,7 +26,7 @@ var RenderTexture = require('./RenderTexture'); * @method Phaser.GameObjects.GameObjectCreator#renderTexture * @since 3.2.0 * - * @param {object} config - [description] + * @param {RenderTextureConfig} config - [description] * * @return {Phaser.GameObjects.RenderTexture} The Game Object that was created. */ diff --git a/src/gameobjects/tilesprite/TileSpriteCreator.js b/src/gameobjects/tilesprite/TileSpriteCreator.js index a541c6444..e4ca780e8 100644 --- a/src/gameobjects/tilesprite/TileSpriteCreator.js +++ b/src/gameobjects/tilesprite/TileSpriteCreator.js @@ -9,6 +9,18 @@ var GameObjectCreator = require('../GameObjectCreator'); var GetAdvancedValue = require('../../utils/object/GetAdvancedValue'); var TileSprite = require('./TileSprite'); +/** + * @typedef {object} TileSprite + * @extends GameObjectConfig + * + * @property {number} [x=0] - [description] + * @property {number} [y=0] - [description] + * @property {number} [width=512] - [description] + * @property {number} [height=512] - [description] + * @property {string} [key=''] - [description] + * @property {string} [frame=''] - [description] + */ + /** * Creates a new TileSprite Game Object and returns it. * @@ -17,7 +29,7 @@ var TileSprite = require('./TileSprite'); * @method Phaser.GameObjects.GameObjectCreator#tileSprite * @since 3.0.0 * - * @param {object} config - [description] + * @param {TileSprite} config - [description] * * @return {Phaser.GameObjects.TileSprite} The Game Object that was created. */ diff --git a/src/input/gamepad/configs/SNES_USB_Controller.js b/src/input/gamepad/configs/SNES_USB_Controller.js index 6633956c2..6fe3aa535 100644 --- a/src/input/gamepad/configs/SNES_USB_Controller.js +++ b/src/input/gamepad/configs/SNES_USB_Controller.js @@ -7,12 +7,11 @@ /** * Tatar SNES USB Controller Gamepad Configuration. * USB Gamepad (STANDARD GAMEPAD Vendor: 0079 Product: 0011) - * + * * @name Phaser.Input.Gamepad.Configs.SNES_USB * @type {object} * @since 3.0.0 */ - module.exports = { UP: 12, diff --git a/src/input/gamepad/configs/Sony_PlayStation_DualShock_4.js b/src/input/gamepad/configs/Sony_PlayStation_DualShock_4.js index d6bd72e97..c9d6a95ec 100644 --- a/src/input/gamepad/configs/Sony_PlayStation_DualShock_4.js +++ b/src/input/gamepad/configs/Sony_PlayStation_DualShock_4.js @@ -7,12 +7,11 @@ /** * PlayStation DualShock 4 Gamepad Configuration. * Sony PlayStation DualShock 4 (v2) wireless controller - * + * * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4 * @type {object} * @since 3.0.0 */ - module.exports = { UP: 12, diff --git a/src/input/gamepad/configs/XBox360_Controller.js b/src/input/gamepad/configs/XBox360_Controller.js index c64bd7ab6..d1299289b 100644 --- a/src/input/gamepad/configs/XBox360_Controller.js +++ b/src/input/gamepad/configs/XBox360_Controller.js @@ -6,12 +6,11 @@ /** * XBox 360 Gamepad Configuration. - * + * * @name Phaser.Input.Gamepad.Configs.XBOX_360 * @type {object} * @since 3.0.0 */ - module.exports = { UP: 12, diff --git a/src/input/keyboard/KeyboardManager.js b/src/input/keyboard/KeyboardManager.js index f20d1b00b..701b41108 100644 --- a/src/input/keyboard/KeyboardManager.js +++ b/src/input/keyboard/KeyboardManager.js @@ -322,7 +322,7 @@ var KeyboardManager = new Class({ * @since 3.0.0 * * @param {(string|integer[]|object[])} keys - [description] - * @param {object} config - [description] + * @param {KeyComboConfig} config - [description] * * @return {Phaser.Input.Keyboard.KeyCombo} [description] */ diff --git a/src/input/keyboard/combo/KeyCombo.js b/src/input/keyboard/combo/KeyCombo.js index 6f2791a37..3bc19409b 100644 --- a/src/input/keyboard/combo/KeyCombo.js +++ b/src/input/keyboard/combo/KeyCombo.js @@ -15,6 +15,15 @@ var ResetKeyCombo = require('./ResetKeyCombo'); * @param {KeyboardEvent} event - [description] */ +/** + * @typedef {object} KeyComboConfig + * + * @property {boolean} [resetOnWrongKey=true] - [description] + * @property {number} [maxKeyDelay=0] - [description] + * @property {boolean} [resetOnMatch=false] - [description] + * @property {boolean} [deleteOnMatch=false] - [description] + */ + /** * @classdesc * [description] @@ -32,7 +41,7 @@ var ResetKeyCombo = require('./ResetKeyCombo'); * * @param {Phaser.Input.Keyboard.KeyboardManager} keyboardManager - [description] * @param {(string|integer[]|object[])} keys - [description] - * @param {object} [config] - [description] + * @param {KeyComboConfig} [config] - [description] */ var KeyCombo = new Class({ diff --git a/src/loader/File.js b/src/loader/File.js index e62149171..92a55c85b 100644 --- a/src/loader/File.js +++ b/src/loader/File.js @@ -18,6 +18,19 @@ var XHRSettings = require('./XHRSettings'); * @param {Phaser.Loader.File} file - [description] */ +/** + * @typedef {object} FileConfig + * + * @property {(string|false)} [type=false] - The file type string (image, json, etc) for sorting within the Loader. + * @property {(string|false)} [key=false] - Unique cache key (unique within its file type) + * @property {string} [url] - The URL of the file, not including baseURL. + * @property {string} [path=''] - [description] + * @property {string} [extension=''] - [description] + * @property {XMLHttpRequestResponseType} [responseType] - [description] + * @property {(XHRSettingsObject|false)} [xhrSettings=false] - [description] + * @property {object} [config] - A config object that can be used by file types to store transitional data. + */ + /** * @classdesc * [description] @@ -27,7 +40,7 @@ var XHRSettings = require('./XHRSettings'); * @constructor * @since 3.0.0 * - * @param {object} fileConfig - [description] + * @param {FileConfig} fileConfig - [description] */ var File = new Class({ @@ -89,7 +102,7 @@ var File = new Class({ * The merged XHRSettings for this file. * * @name Phaser.Loader.File#xhrSettings - * @type {Phaser.Loader.XHRSettingsConfig} + * @type {XHRSettingsObject} * @since 3.0.0 */ this.xhrSettings = XHRSettings(GetFastValue(fileConfig, 'responseType', undefined)); @@ -109,10 +122,10 @@ var File = new Class({ this.loader = null; /** - * The XHR Loader function that is loading this File. + * The XHR Loader instance that is loading this File. * * @name Phaser.Loader.File#xhrLoader - * @type {?function} + * @type {?Phaser.Loader.XHRLoader} * @since 3.0.0 */ this.xhrLoader = null; @@ -404,7 +417,7 @@ var File = new Class({ * * @method Phaser.Loader.File.createObjectURL * @static - * @param {HTMLImageElement} image - Image object which 'src' attribute should be set to object URL. + * @param {Image} image - Image object which 'src' attribute should be set to object URL. * @param {Blob} blob - A Blob object to create an object URL for. * @param {string} defaultType - Default mime type used if blob type is not available. */ @@ -436,7 +449,7 @@ File.createObjectURL = function (image, blob, defaultType) * * @method Phaser.Loader.File.revokeObjectURL * @static - * @param {HTMLImageElement} image - Image object which 'src' attribute should be revoked. + * @param {Image} image - Image object which 'src' attribute should be revoked. */ File.revokeObjectURL = function (image) { diff --git a/src/loader/LoaderPlugin.js b/src/loader/LoaderPlugin.js index b8a3801ae..20e2f0d93 100644 --- a/src/loader/LoaderPlugin.js +++ b/src/loader/LoaderPlugin.js @@ -122,7 +122,7 @@ var LoaderPlugin = new Class({ * xhr specific global settings (can be overridden on a per-file basis) * * @name Phaser.Loader.LoaderPlugin#xhr - * @type {Phaser.Loader.XHRSettingsConfig} + * @type {XHRSettingsObject} * @since 3.0.0 */ this.xhr = XHRSettings( diff --git a/src/loader/MergeXHRSettings.js b/src/loader/MergeXHRSettings.js index e5a407032..5b79d68b7 100644 --- a/src/loader/MergeXHRSettings.js +++ b/src/loader/MergeXHRSettings.js @@ -16,10 +16,10 @@ var XHRSettings = require('./XHRSettings'); * @function Phaser.Loader.MergeXHRSettings * @since 3.0.0 * - * @param {Phaser.Loader.XHRSettingsConfig} global - The global XHRSettings object. - * @param {Phaser.Loader.XHRSettingsConfig} local - The local XHRSettings object. + * @param {XHRSettingsObject} global - The global XHRSettings object. + * @param {XHRSettingsObject} local - The local XHRSettings object. * - * @return {Phaser.Loader.XHRSettingsConfig} A newly formed XHRSettings object. + * @return {XHRSettingsObject} A newly formed XHRSettings object. */ var MergeXHRSettings = function (global, local) { diff --git a/src/loader/XHRLoader.js b/src/loader/XHRLoader.js index dd66dffd7..df32eb721 100644 --- a/src/loader/XHRLoader.js +++ b/src/loader/XHRLoader.js @@ -15,7 +15,7 @@ var MergeXHRSettings = require('./MergeXHRSettings'); * @since 3.0.0 * * @param {Phaser.Loader.File} file - The File to download. - * @param {Phaser.Loader.XHRSettingsConfig} globalXHRSettings - The global XHRSettings object. + * @param {XHRSettingsObject} globalXHRSettings - The global XHRSettings object. * * @return {XMLHttpRequest} The XHR object. */ diff --git a/src/loader/XHRSettings.js b/src/loader/XHRSettings.js index b055ee179..c42a39960 100644 --- a/src/loader/XHRSettings.js +++ b/src/loader/XHRSettings.js @@ -5,13 +5,16 @@ */ /** - * @typedef {object} Phaser.Loader.XHRSettingsConfig + * @typedef {object} XHRSettingsObject * - * @property {string} [responseType=''] - [description] - * @property {boolean} [async=true] - [description] - * @property {string} [user=''] - [description] - * @property {string} [password=''] - [description] - * @property {integer} [timeout=0] - [description] + * @property {XMLHttpRequestResponseType} responseType - [description] + * @property {boolean} async - [description] + * @property {string} user - [description] + * @property {string} password - [description] + * @property {number} timeout - [description] + * @property {?string} header - [description] + * @property {?string} headerValue - [description] + * @property {(string|undefined)} overrideMimeType - [description] */ /** @@ -20,13 +23,13 @@ * @function Phaser.Loader.XHRSettings * @since 3.0.0 * - * @param {string} [responseType=''] - The responseType, such as 'text'. + * @param {XMLHttpRequestResponseType} [responseType=''] - The responseType, such as 'text'. * @param {boolean} [async=true] - Should the XHR request use async or not? * @param {string} [user=''] - Optional username for the XHR request. * @param {string} [password=''] - Optional password for the XHR request. * @param {integer} [timeout=0] - Optional XHR timeout value. * - * @return {Phaser.Loader.XHRSettingsConfig} The XHRSettings object as used by the Loader. + * @return {XHRSettingsObject} The XHRSettings object as used by the Loader. */ var XHRSettings = function (responseType, async, user, password, timeout) { @@ -36,8 +39,8 @@ var XHRSettings = function (responseType, async, user, password, timeout) if (password === undefined) { password = ''; } if (timeout === undefined) { timeout = 0; } - // Before sending a request, set the xhr.responseType to "text", - // "arraybuffer", "blob", or "document", depending on your data needs. + // Before sending a request, set the xhr.responseType to "text", + // "arraybuffer", "blob", or "document", depending on your data needs. // Note, setting xhr.responseType = '' (or omitting) will default the response to "text". return { diff --git a/src/loader/filetypes/AnimationJSONFile.js b/src/loader/filetypes/AnimationJSONFile.js index 3423e19f2..2cdec9ebe 100644 --- a/src/loader/filetypes/AnimationJSONFile.js +++ b/src/loader/filetypes/AnimationJSONFile.js @@ -16,9 +16,9 @@ var JSONFile = require('./JSONFile.js'); * @param {string} key - The key of the file within the loader. * @param {string} url - The url to load the file from. * @param {string} path - The path of the file. - * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - Optional file specific XHR settings. + * @param {XHRSettingsObject} xhrSettings - Optional file specific XHR settings. * - * @return {Phaser.Loader.FileTypes.JSONFile} A File instance to be added to the Loader. + * @return {Phaser.Loader.FileTypes.AnimationJSONFile} A File instance to be added to the Loader. */ var AnimationJSONFile = function (key, url, path, xhrSettings) { @@ -44,7 +44,7 @@ var AnimationJSONFile = function (key, url, path, xhrSettings) * @param {(string|array|object)} key - A unique string to be used as the key to reference this file from the Cache. Must be unique within this file type. * @param {string} [url] - URL of the file. If `undefined` or `null` the url will be set to `.json`, * i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {object} [xhrSettings] - File specific XHR settings to be used during the load. These settings are merged with the global Loader XHR settings. + * @param {XHRSettingsObject} [xhrSettings] - File specific XHR settings to be used during the load. These settings are merged with the global Loader XHR settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ diff --git a/src/loader/filetypes/AtlasJSONFile.js b/src/loader/filetypes/AtlasJSONFile.js index c18f870f4..fcdbf017f 100644 --- a/src/loader/filetypes/AtlasJSONFile.js +++ b/src/loader/filetypes/AtlasJSONFile.js @@ -18,8 +18,8 @@ var JSONFile = require('./JSONFile.js'); * @param {string} textureURL - The url to load the texture file from. * @param {string} atlasURL - The url to load the atlas file from. * @param {string} path - The path of the file. - * @param {Phaser.Loader.XHRSettingsConfig} textureXhrSettings - Optional texture file specific XHR settings. - * @param {Phaser.Loader.XHRSettingsConfig} atlasXhrSettings - Optional atlas file specific XHR settings. + * @param {XHRSettingsObject} textureXhrSettings - Optional texture file specific XHR settings. + * @param {XHRSettingsObject} atlasXhrSettings - Optional atlas file specific XHR settings. * * @return {object} An object containing two File objects to be added to the loader. */ @@ -53,8 +53,8 @@ var AtlasJSONFile = function (key, textureURL, atlasURL, path, textureXhrSetting * @param {string} key - The key of the file within the loader. * @param {string} textureURL - The url to load the texture file from. * @param {string} atlasURL - The url to load the atlas file from. - * @param {object} textureXhrSettings - Optional texture file specific XHR settings. - * @param {object} atlasXhrSettings - Optional atlas file specific XHR settings. + * @param {XHRSettingsObject} textureXhrSettings - Optional texture file specific XHR settings. + * @param {XHRSettingsObject} atlasXhrSettings - Optional atlas file specific XHR settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ diff --git a/src/loader/filetypes/AudioFile.js b/src/loader/filetypes/AudioFile.js index b8adda949..e751d4c91 100644 --- a/src/loader/filetypes/AudioFile.js +++ b/src/loader/filetypes/AudioFile.js @@ -24,7 +24,7 @@ var HTML5AudioFile = require('./HTML5AudioFile'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] + * @param {XHRSettingsObject} xhrSettings - [description] * @param {AudioContext} audioContext - [description] */ var AudioFile = new Class({ diff --git a/src/loader/filetypes/AudioSprite.js b/src/loader/filetypes/AudioSprite.js index b5b55ce7a..7e8bbb386 100644 --- a/src/loader/filetypes/AudioSprite.js +++ b/src/loader/filetypes/AudioSprite.js @@ -24,8 +24,8 @@ var JSONFile = require('./JSONFile.js'); * @param {(string|string[])} urls - [description] * @param {object} json - [description] * @param {object} config - [description] - * @param {Phaser.Loader.XHRSettingsConfig} audioXhrSettings - Optional file specific XHR settings. - * @param {Phaser.Loader.XHRSettingsConfig} jsonXhrSettings - Optional file specific XHR settings. + * @param {XHRSettingsObject} audioXhrSettings - Optional file specific XHR settings. + * @param {XHRSettingsObject} jsonXhrSettings - Optional file specific XHR settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ diff --git a/src/loader/filetypes/BinaryFile.js b/src/loader/filetypes/BinaryFile.js index 20ee12129..b4c251b6f 100644 --- a/src/loader/filetypes/BinaryFile.js +++ b/src/loader/filetypes/BinaryFile.js @@ -23,7 +23,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] + * @param {XHRSettingsObject} xhrSettings - [description] */ var BinaryFile = new Class({ @@ -63,7 +63,7 @@ var BinaryFile = new Class({ /** * Adds Binary file to the current load queue. - * + * * Note: This method will only be available if the Binary File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -74,8 +74,8 @@ var BinaryFile = new Class({ * * @param {string} key - [description] * @param {string} url - [description] - * @param {object} xhrSettings - [description] - * + * @param {XHRSettingsObject} xhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('binary', function (key, url, xhrSettings) diff --git a/src/loader/filetypes/BitmapFontFile.js b/src/loader/filetypes/BitmapFontFile.js index 9449f2d8e..2d38cec1f 100644 --- a/src/loader/filetypes/BitmapFontFile.js +++ b/src/loader/filetypes/BitmapFontFile.js @@ -18,8 +18,8 @@ var XMLFile = require('./XMLFile.js'); * @param {string} textureURL - The url to load the texture file from. * @param {string} xmlURL - The url to load the atlas file from. * @param {string} path - The path of the file. - * @param {Phaser.Loader.XHRSettingsConfig} textureXhrSettings - Optional texture file specific XHR settings. - * @param {Phaser.Loader.XHRSettingsConfig} xmlXhrSettings - Optional atlas file specific XHR settings. + * @param {XHRSettingsObject} textureXhrSettings - Optional texture file specific XHR settings. + * @param {XHRSettingsObject} xmlXhrSettings - Optional atlas file specific XHR settings. * * @return {object} An object containing two File objects to be added to the loader. */ @@ -41,7 +41,7 @@ var BitmapFontFile = function (key, textureURL, xmlURL, path, textureXhrSettings /** * Adds a Bitmap Font file to the current load queue. - * + * * Note: This method will only be available if the Bitmap Font File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -53,9 +53,9 @@ var BitmapFontFile = function (key, textureURL, xmlURL, path, textureXhrSettings * @param {string} key - [description] * @param {string} textureURL - [description] * @param {string} xmlURL - [description] - * @param {object} textureXhrSettings - [description] - * @param {object} xmlXhrSettings - [description] - * + * @param {XHRSettingsObject} textureXhrSettings - [description] + * @param {XHRSettingsObject} xmlXhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('bitmapFont', function (key, textureURL, xmlURL, textureXhrSettings, xmlXhrSettings) diff --git a/src/loader/filetypes/GLSLFile.js b/src/loader/filetypes/GLSLFile.js index 1914b54ed..0de43145d 100644 --- a/src/loader/filetypes/GLSLFile.js +++ b/src/loader/filetypes/GLSLFile.js @@ -23,7 +23,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] + * @param {XHRSettingsObject} xhrSettings - [description] */ var GLSLFile = new Class({ @@ -63,7 +63,7 @@ var GLSLFile = new Class({ /** * Adds a GLSL file to the current load queue. - * + * * Note: This method will only be available if the GLSL File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -74,8 +74,8 @@ var GLSLFile = new Class({ * * @param {string} key - [description] * @param {string} url - [description] - * @param {object} xhrSettings - [description] - * + * @param {XHRSettingsObject} xhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('glsl', function (key, url, xhrSettings) diff --git a/src/loader/filetypes/HTMLFile.js b/src/loader/filetypes/HTMLFile.js index 8043297a0..c219998ea 100644 --- a/src/loader/filetypes/HTMLFile.js +++ b/src/loader/filetypes/HTMLFile.js @@ -25,7 +25,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @param {number} width - [description] * @param {number} height - [description] * @param {string} path - [description] - * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] + * @param {XHRSettingsObject} xhrSettings - [description] */ var HTMLFile = new Class({ @@ -119,7 +119,7 @@ var HTMLFile = new Class({ /** * Adds an HTML file to the current load queue. - * + * * Note: This method will only be available if the HTML File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -132,8 +132,8 @@ var HTMLFile = new Class({ * @param {string} url - [description] * @param {number} width - [description] * @param {number} height - [description] - * @param {object} xhrSettings - [description] - * + * @param {XHRSettingsObject} xhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('html', function (key, url, width, height, xhrSettings) diff --git a/src/loader/filetypes/ImageFile.js b/src/loader/filetypes/ImageFile.js index d52623cc5..90aaf7bda 100644 --- a/src/loader/filetypes/ImageFile.js +++ b/src/loader/filetypes/ImageFile.js @@ -23,7 +23,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] + * @param {XHRSettingsObject} xhrSettings - [description] * @param {object} config - [description] */ var ImageFile = new Class({ @@ -101,7 +101,7 @@ var ImageFile = new Class({ /** * Adds an Image file to the current load queue. - * + * * Note: This method will only be available if the Image File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -112,8 +112,8 @@ var ImageFile = new Class({ * * @param {string} key - [description] * @param {string} url - [description] - * @param {object} xhrSettings - [description] - * + * @param {XHRSettingsObject} xhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('image', function (key, url, xhrSettings) diff --git a/src/loader/filetypes/JSONFile.js b/src/loader/filetypes/JSONFile.js index 88d05e142..fb78b507a 100644 --- a/src/loader/filetypes/JSONFile.js +++ b/src/loader/filetypes/JSONFile.js @@ -23,7 +23,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] + * @param {XHRSettingsObject} xhrSettings - [description] */ var JSONFile = new Class({ @@ -73,7 +73,7 @@ var JSONFile = new Class({ /** * Adds a JSON file to the current load queue. - * + * * Note: This method will only be available if the JSON File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -84,8 +84,8 @@ var JSONFile = new Class({ * * @param {string} key - [description] * @param {string} url - [description] - * @param {object} xhrSettings - [description] - * + * @param {XHRSettingsObject} xhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('json', function (key, url, xhrSettings) diff --git a/src/loader/filetypes/MultiAtlas.js b/src/loader/filetypes/MultiAtlas.js index ead50b96d..cc07bf62f 100644 --- a/src/loader/filetypes/MultiAtlas.js +++ b/src/loader/filetypes/MultiAtlas.js @@ -11,7 +11,7 @@ var NumberArray = require('../../utils/array/NumberArray'); /** * Adds a Multi File Texture Atlas to the current load queue. - * + * * Note: This method will only be available if the Multi Atlas File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -23,9 +23,9 @@ var NumberArray = require('../../utils/array/NumberArray'); * @param {string} key - [description] * @param {string[]} textureURLs - [description] * @param {string[]} atlasURLs - [description] - * @param {Phaser.Loader.XHRSettingsConfig} textureXhrSettings - [description] - * @param {Phaser.Loader.XHRSettingsConfig} atlasXhrSettings - [description] - * + * @param {XHRSettingsObject} textureXhrSettings - [description] + * @param {XHRSettingsObject} atlasXhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('multiatlas', function (key, textureURLs, atlasURLs, textureXhrSettings, atlasXhrSettings) diff --git a/src/loader/filetypes/PluginFile.js b/src/loader/filetypes/PluginFile.js index 816dfbac1..1a466073f 100644 --- a/src/loader/filetypes/PluginFile.js +++ b/src/loader/filetypes/PluginFile.js @@ -24,7 +24,7 @@ var PluginManager = require('../../boot/PluginManager'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] + * @param {XHRSettingsObject} xhrSettings - [description] */ var PluginFile = new Class({ @@ -81,7 +81,7 @@ var PluginFile = new Class({ /** * Adds a Plugin file to the current load queue. - * + * * Note: This method will only be available if the Plugin File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -92,8 +92,8 @@ var PluginFile = new Class({ * * @param {string} key - [description] * @param {string} url - [description] - * @param {object} xhrSettings - [description] - * + * @param {XHRSettingsObject} xhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('plugin', function (key, url, xhrSettings) diff --git a/src/loader/filetypes/SVGFile.js b/src/loader/filetypes/SVGFile.js index 1e775e196..35a1c1426 100644 --- a/src/loader/filetypes/SVGFile.js +++ b/src/loader/filetypes/SVGFile.js @@ -23,7 +23,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] + * @param {XHRSettingsObject} xhrSettings - [description] */ var SVGFile = new Class({ @@ -112,7 +112,7 @@ var SVGFile = new Class({ /** * Adds an SVG file to the current load queue. - * + * * Note: This method will only be available if the SVG File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -123,8 +123,8 @@ var SVGFile = new Class({ * * @param {string} key - [description] * @param {string} url - [description] - * @param {object} xhrSettings - [description] - * + * @param {XHRSettingsObject} xhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('svg', function (key, url, xhrSettings) diff --git a/src/loader/filetypes/ScriptFile.js b/src/loader/filetypes/ScriptFile.js index 86aed836d..5d67fb3b8 100644 --- a/src/loader/filetypes/ScriptFile.js +++ b/src/loader/filetypes/ScriptFile.js @@ -23,7 +23,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] + * @param {XHRSettingsObject} xhrSettings - [description] */ var ScriptFile = new Class({ @@ -69,7 +69,7 @@ var ScriptFile = new Class({ /** * Adds a JavaScript file to the current load queue. - * + * * Note: This method will only be available if the Script File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -80,8 +80,8 @@ var ScriptFile = new Class({ * * @param {string} key - [description] * @param {string} url - [description] - * @param {object} xhrSettings - [description] - * + * @param {XHRSettingsObject} xhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('script', function (key, url, xhrSettings) diff --git a/src/loader/filetypes/SpriteSheetFile.js b/src/loader/filetypes/SpriteSheetFile.js index e689d1cb5..ff46d57f6 100644 --- a/src/loader/filetypes/SpriteSheetFile.js +++ b/src/loader/filetypes/SpriteSheetFile.js @@ -17,7 +17,7 @@ var ImageFile = require('./ImageFile.js'); * @param {string} url - The url to load the texture file from. * @param {object} config - Optional texture file specific XHR settings. * @param {string} path - Optional texture file specific XHR settings. - * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - Optional atlas file specific XHR settings. + * @param {XHRSettingsObject} xhrSettings - Optional atlas file specific XHR settings. * * @return {object} An object containing two File objects to be added to the loader. */ @@ -33,7 +33,7 @@ var SpriteSheetFile = function (key, url, config, path, xhrSettings) /** * Adds a Sprite Sheet file to the current load queue. - * + * * Note: This method will only be available if the Sprite Sheet File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -45,8 +45,8 @@ var SpriteSheetFile = function (key, url, config, path, xhrSettings) * @param {string} key - [description] * @param {string} url - [description] * @param {object} config - config can include: frameWidth, frameHeight, startFrame, endFrame, margin, spacing. - * @param {object} xhrSettings - [description] - * + * @param {XHRSettingsObject} xhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('spritesheet', function (key, url, config, xhrSettings) diff --git a/src/loader/filetypes/TextFile.js b/src/loader/filetypes/TextFile.js index c420120db..438365786 100644 --- a/src/loader/filetypes/TextFile.js +++ b/src/loader/filetypes/TextFile.js @@ -22,7 +22,7 @@ var FileTypesManager = require('../FileTypesManager'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] + * @param {XHRSettingsObject} xhrSettings - [description] */ var TextFile = new Class({ @@ -60,7 +60,7 @@ var TextFile = new Class({ /** * Adds a Text file to the current load queue. - * + * * Note: This method will only be available if the Text File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -71,8 +71,8 @@ var TextFile = new Class({ * * @param {string} key - [description] * @param {string} url - [description] - * @param {object} xhrSettings - [description] - * + * @param {XHRSettingsObject} xhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('text', function (key, url, xhrSettings) diff --git a/src/loader/filetypes/TilemapCSVFile.js b/src/loader/filetypes/TilemapCSVFile.js index a71fccb94..c5ef91bc4 100644 --- a/src/loader/filetypes/TilemapCSVFile.js +++ b/src/loader/filetypes/TilemapCSVFile.js @@ -24,7 +24,7 @@ var TILEMAP_FORMATS = require('../../tilemaps/Formats'); * @param {string} url - [description] * @param {string} path - [description] * @param {string} format - [description] - * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] + * @param {XHRSettingsObject} xhrSettings - [description] */ var TilemapCSVFile = new Class({ @@ -64,7 +64,7 @@ var TilemapCSVFile = new Class({ /** * Adds a Tilemap CSV file to the current load queue. - * + * * Note: This method will only be available if the Tilemap CSV File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -75,8 +75,8 @@ var TilemapCSVFile = new Class({ * * @param {string} key - [description] * @param {string} url - [description] - * @param {object} xhrSettings - [description] - * + * @param {XHRSettingsObject} xhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('tilemapCSV', function (key, url, xhrSettings) diff --git a/src/loader/filetypes/TilemapJSONFile.js b/src/loader/filetypes/TilemapJSONFile.js index e5d04c5e7..367cce7cb 100644 --- a/src/loader/filetypes/TilemapJSONFile.js +++ b/src/loader/filetypes/TilemapJSONFile.js @@ -18,7 +18,7 @@ var TILEMAP_FORMATS = require('../../tilemaps/Formats'); * @param {string} url - [description] * @param {string} path - [description] * @param {string} format - [description] - * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] + * @param {XHRSettingsObject} xhrSettings - [description] * * @return {object} An object containing two File objects to be added to the loader. */ @@ -36,7 +36,7 @@ var TilemapJSONFile = function (key, url, path, format, xhrSettings) /** * Adds a Tilemap (Tiled JSON Format) file to the current load queue. - * + * * Note: This method will only be available if the Tilemap File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -47,8 +47,8 @@ var TilemapJSONFile = function (key, url, path, format, xhrSettings) * * @param {string} key - [description] * @param {string} url - [description] - * @param {object} xhrSettings - [description] - * + * @param {XHRSettingsObject} xhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('tilemapTiledJSON', function (key, url, xhrSettings) @@ -72,7 +72,7 @@ FileTypesManager.register('tilemapTiledJSON', function (key, url, xhrSettings) /** * Adds a Tilemap (Weltmeister Format) file to the current load queue. - * + * * Note: This method will only be available if the Tilemap File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -83,8 +83,8 @@ FileTypesManager.register('tilemapTiledJSON', function (key, url, xhrSettings) * * @param {string} key - [description] * @param {string} url - [description] - * @param {object} xhrSettings - [description] - * + * @param {XHRSettingsObject} xhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('tilemapWeltmeister', function (key, url, xhrSettings) diff --git a/src/loader/filetypes/UnityAtlasFile.js b/src/loader/filetypes/UnityAtlasFile.js index f68b0c088..5ddd9a2d6 100644 --- a/src/loader/filetypes/UnityAtlasFile.js +++ b/src/loader/filetypes/UnityAtlasFile.js @@ -18,8 +18,8 @@ var TextFile = require('./TextFile.js'); * @param {string} textureURL - The url to load the texture file from. * @param {string} atlasURL - The url to load the atlas file from. * @param {string} path - The path of the file. - * @param {Phaser.Loader.XHRSettingsConfig} textureXhrSettings - Optional texture file specific XHR settings. - * @param {Phaser.Loader.XHRSettingsConfig} atlasXhrSettings - Optional atlas file specific XHR settings. + * @param {XHRSettingsObject} textureXhrSettings - Optional texture file specific XHR settings. + * @param {XHRSettingsObject} atlasXhrSettings - Optional atlas file specific XHR settings. * * @return {object} An object containing two File objects to be added to the loader. */ @@ -41,7 +41,7 @@ var UnityAtlasFile = function (key, textureURL, atlasURL, path, textureXhrSettin /** * Adds a Unity Texture Atlas file to the current load queue. - * + * * Note: This method will only be available if the Unity Atlas File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -53,9 +53,9 @@ var UnityAtlasFile = function (key, textureURL, atlasURL, path, textureXhrSettin * @param {string} key - The key of the file within the loader. * @param {string} textureURL - The url to load the texture file from. * @param {string} atlasURL - The url to load the atlas file from. - * @param {object} textureXhrSettings - Optional texture file specific XHR settings. - * @param {object} atlasXhrSettings - Optional atlas file specific XHR settings. - * + * @param {XHRSettingsObject} textureXhrSettings - Optional texture file specific XHR settings. + * @param {XHRSettingsObject} atlasXhrSettings - Optional atlas file specific XHR settings. + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('unityAtlas', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) diff --git a/src/loader/filetypes/XMLFile.js b/src/loader/filetypes/XMLFile.js index f8b82e82f..37397061f 100644 --- a/src/loader/filetypes/XMLFile.js +++ b/src/loader/filetypes/XMLFile.js @@ -24,7 +24,7 @@ var ParseXML = require('../../dom/ParseXML'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] + * @param {XHRSettingsObject} xhrSettings - [description] */ var XMLFile = new Class({ @@ -69,7 +69,7 @@ var XMLFile = new Class({ /** * Adds an XML file to the current load queue. - * + * * Note: This method will only be available if the XML File type has been built into Phaser. * * The file is **not** loaded immediately after calling this method. @@ -80,8 +80,8 @@ var XMLFile = new Class({ * * @param {string} key - [description] * @param {string} url - [description] - * @param {object} xhrSettings - [description] - * + * @param {XHRSettingsObject} xhrSettings - [description] + * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ FileTypesManager.register('xml', function (key, url, xhrSettings) diff --git a/src/math/SinCosTableGenerator.js b/src/math/SinCosTableGenerator.js index 0d918dc0c..92de9773a 100644 --- a/src/math/SinCosTableGenerator.js +++ b/src/math/SinCosTableGenerator.js @@ -4,6 +4,13 @@ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +/** + * @typedef {object} SinCosTable + * + * @property {number} sin - [description] + * @property {number} cos - [description] + * @property {number} length - [description] + */ /** * [description] @@ -16,7 +23,7 @@ * @param {number} cosAmp - [description] * @param {number} frequency - [description] * - * @return {object} [description] + * @return {SinCosTable} [description] */ var SinCosTableGenerator = function (length, sinAmp, cosAmp, frequency) { diff --git a/src/math/Vector2.js b/src/math/Vector2.js index b98d09b03..29d25099e 100644 --- a/src/math/Vector2.js +++ b/src/math/Vector2.js @@ -9,6 +9,13 @@ var Class = require('../utils/Class'); +/** + * @typedef {object} Vector2Like + * + * @property {number} x - [description] + * @property {number} y - [description] + */ + /** * @classdesc * [description] @@ -35,6 +42,7 @@ var Vector2 = new Class({ * @default 0 * @since 3.0.0 */ + this.x = 0; /** * The y component of this Vector. @@ -44,6 +52,7 @@ var Vector2 = new Class({ * @default 0 * @since 3.0.0 */ + this.y = 0; if (typeof x === 'object') { @@ -78,7 +87,7 @@ var Vector2 = new Class({ * @method Phaser.Math.Vector2#copy * @since 3.0.0 * - * @param {(Phaser.Math.Vector2|object)} src - [description] + * @param {Phaser.Math.Vector2} src - [description] * * @return {Phaser.Math.Vector2} This Vector2. */ @@ -96,7 +105,7 @@ var Vector2 = new Class({ * @method Phaser.Math.Vector2#setFromObject * @since 3.0.0 * - * @param {object} obj - [description] + * @param {Vector2Like} obj - [description] * * @return {Phaser.Math.Vector2} This Vector2. */ diff --git a/src/physics/arcade/ArcadePhysics.js b/src/physics/arcade/ArcadePhysics.js index 77cf1c0ff..661911d6f 100644 --- a/src/physics/arcade/ArcadePhysics.js +++ b/src/physics/arcade/ArcadePhysics.js @@ -146,7 +146,7 @@ var ArcadePhysics = new Class({ * @param {(Phaser.GameObjects.GameObject|array)} object2 - The second object or array of objects to check. Can be any Game Object that has an Arcade Physics Body. * @param {ArcadePhysicsCallback} [overlapCallback=null] - An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you specified them, unless you are checking Group vs. Sprite, in which case Sprite will always be the first parameter. * @param {ArcadePhysicsCallback} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then `overlapCallback` will only be called if this callback returns `true`. - * @param {object} [callbackContext] - The context in which to run the callbacks. + * @param {*} [callbackContext] - The context in which to run the callbacks. * * @return {boolean} True if an overlap occurred otherwise false. */ @@ -169,7 +169,7 @@ var ArcadePhysics = new Class({ * @param {(Phaser.GameObjects.GameObject|array)} object2 - The second object or array of objects to check. Can be any Game Object that has an Arcade Physics Body. * @param {ArcadePhysicsCallback} [collideCallback=null] - An optional callback function that is called if the objects collide. The two objects will be passed to this function in the same order in which you specified them, unless you are checking Group vs. Sprite, in which case Sprite will always be the first parameter. * @param {ArcadePhysicsCallback} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {object} [callbackContext] - The context in which to run the callbacks. + * @param {*} [callbackContext] - The context in which to run the callbacks. * * @return {boolean} True if a collision occurred otherwise false. */ diff --git a/src/physics/arcade/Body.js b/src/physics/arcade/Body.js index 2d0887cb3..5ad789870 100644 --- a/src/physics/arcade/Body.js +++ b/src/physics/arcade/Body.js @@ -11,6 +11,25 @@ var Rectangle = require('../../geom/rectangle/Rectangle'); var RectangleContains = require('../../geom/rectangle/Contains'); var Vector2 = require('../../math/Vector2'); +/** + * @typedef {object} ArcadeBodyBounds + * + * @property {number} x - [description] + * @property {number} y - [description] + * @property {number} right - [description] + * @property {number} bottom - [description] + */ + +/** + * @typedef {object} ArcadeBodyCollision + * + * @property {boolean} none - [description] + * @property {boolean} up - [description] + * @property {boolean} down - [description] + * @property {boolean} left - [description] + * @property {boolean} right - [description] + */ + /** * @classdesc * [description] @@ -544,7 +563,7 @@ var Body = new Class({ * [description] * * @name Phaser.Physics.Arcade.Body#checkCollision - * @type {object} + * @type {ArcadeBodyCollision} * @since 3.0.0 */ this.checkCollision = { none: false, up: true, down: true, left: true, right: true }; @@ -553,7 +572,7 @@ var Body = new Class({ * [description] * * @name Phaser.Physics.Arcade.Body#touching - * @type {object} + * @type {ArcadeBodyCollision} * @since 3.0.0 */ this.touching = { none: true, up: false, down: false, left: false, right: false }; @@ -562,7 +581,7 @@ var Body = new Class({ * [description] * * @name Phaser.Physics.Arcade.Body#wasTouching - * @type {object} + * @type {ArcadeBodyCollision} * @since 3.0.0 */ this.wasTouching = { none: true, up: false, down: false, left: false, right: false }; @@ -571,7 +590,7 @@ var Body = new Class({ * [description] * * @name Phaser.Physics.Arcade.Body#blocked - * @type {object} + * @type {ArcadeBodyCollision} * @since 3.0.0 */ this.blocked = { none: true, up: false, down: false, left: false, right: false }; @@ -1126,9 +1145,9 @@ var Body = new Class({ * @method Phaser.Physics.Arcade.Body#getBounds * @since 3.0.0 * - * @param {object} obj - [description] + * @param {ArcadeBodyBounds} obj - [description] * - * @return {object} [description] + * @return {ArcadeBodyBounds} [description] */ getBounds: function (obj) { diff --git a/src/physics/arcade/Factory.js b/src/physics/arcade/Factory.js index 624ae33f3..327826eca 100644 --- a/src/physics/arcade/Factory.js +++ b/src/physics/arcade/Factory.js @@ -67,7 +67,7 @@ var Factory = new Class({ * @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for collision. * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. - * @param {object} callbackContext - The scope in which to call the callbacks. + * @param {*} callbackContext - The scope in which to call the callbacks. * * @return {Phaser.Physics.Arcade.Collider} The Collider that was created. */ @@ -86,7 +86,7 @@ var Factory = new Class({ * @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for overlap. * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. - * @param {object} callbackContext - The scope in which to call the callbacks. + * @param {*} callbackContext - The scope in which to call the callbacks. * * @return {Phaser.Physics.Arcade.Collider} The Collider that was created. */ @@ -196,7 +196,7 @@ var Factory = new Class({ * * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. - * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.Physics.Arcade.Sprite} The Sprite object that was created. @@ -221,7 +221,7 @@ var Factory = new Class({ * @since 3.0.0 * * @param {array} [children] - [description] - * @param {object} [config] - [description] + * @param {GroupConfig} [config] - [description] * * @return {Phaser.Physics.Arcade.StaticGroup} The Static Group object that was created. */ @@ -238,7 +238,7 @@ var Factory = new Class({ * @since 3.0.0 * * @param {array} [children] - [description] - * @param {object} [config] - [description] + * @param {PhysicsGroupConfig} [config] - [description] * * @return {Phaser.Physics.Arcade.Group} The Group object that was created. */ diff --git a/src/physics/arcade/PhysicsGroup.js b/src/physics/arcade/PhysicsGroup.js index d68dd0af9..cdd37dd0f 100644 --- a/src/physics/arcade/PhysicsGroup.js +++ b/src/physics/arcade/PhysicsGroup.js @@ -10,10 +10,57 @@ var CONST = require('./const'); var GetFastValue = require('../../utils/object/GetFastValue'); var Group = require('../../gameobjects/group/Group'); +/** + * @typedef {object} PhysicsGroupConfig + * @extends GroupConfig + * + * @property {[type]} [collideWorldBounds=false] - [description] + * @property {number} [accelerationX=0] - [description] + * @property {number} [accelerationY=0] - [description] + * @property {number} [bounceX=0] - [description] + * @property {number} [bounceY=0] - [description] + * @property {number} [dragX=0] - [description] + * @property {number} [dragY=0] - [description] + * @property {number} [gravityX=0] - [description] + * @property {number} [gravityY=0] - [description] + * @property {number} [frictionX=0] - [description] + * @property {number} [frictionY=0] - [description] + * @property {number} [velocityX=0] - [description] + * @property {number} [velocityY=0] - [description] + * @property {number} [angularVelocity=0] - [description] + * @property {number} [angularAcceleration=0] - [description] + * @property {number} [angularDrag=0] - [description] + * @property {number} [mass=0] - [description] + * @property {boolean} [immovable=false] - [description] + */ + +/** + * @typedef {object} PhysicsGroupDefaults + * + * @property {[type]} setCollideWorldBounds - [description] + * @property {number} setAccelerationX - [description] + * @property {number} setAccelerationY - [description] + * @property {number} setBounceX - [description] + * @property {number} setBounceY - [description] + * @property {number} setDragX - [description] + * @property {number} setDragY - [description] + * @property {number} setGravityX - [description] + * @property {number} setGravityY - [description] + * @property {number} setFrictionX - [description] + * @property {number} setFrictionY - [description] + * @property {number} setVelocityX - [description] + * @property {number} setVelocityY - [description] + * @property {number} setAngularVelocity - [description] + * @property {number} setAngularAcceleration - [description] + * @property {number} setAngularDrag - [description] + * @property {number} setMass - [description] + * @property {boolean} setImmovable - [description] + */ + /** * @classdesc * An Arcade Physics Group object. - * + * * All Game Objects created by this Group will automatically be dynamic Arcade Physics objects. * * @class Group @@ -25,7 +72,7 @@ var Group = require('../../gameobjects/group/Group'); * @param {Phaser.Physics.Arcade.World} world - [description] * @param {Phaser.Scene} scene - [description] * @param {array} children - [description] - * @param {object} config - [description] + * @param {PhysicsGroupConfig} [config] - [description] */ var PhysicsGroup = new Class({ @@ -72,7 +119,7 @@ var PhysicsGroup = new Class({ * [description] * * @name Phaser.Physics.Arcade.Group#defaults - * @type {object} + * @type {PhysicsGroupDefaults} * @since 3.0.0 */ this.defaults = { diff --git a/src/physics/arcade/StaticBody.js b/src/physics/arcade/StaticBody.js index 49cd0ce57..a4ff68128 100644 --- a/src/physics/arcade/StaticBody.js +++ b/src/physics/arcade/StaticBody.js @@ -320,7 +320,7 @@ var StaticBody = new Class({ * [description] * * @name Phaser.Physics.Arcade.StaticBody#checkCollision - * @type {object} + * @type {ArcadeBodyCollision} * @since 3.0.0 */ this.checkCollision = { none: false, up: true, down: true, left: true, right: true }; @@ -329,7 +329,7 @@ var StaticBody = new Class({ * [description] * * @name Phaser.Physics.Arcade.StaticBody#touching - * @type {object} + * @type {ArcadeBodyCollision} * @since 3.0.0 */ this.touching = { none: true, up: false, down: false, left: false, right: false }; @@ -338,7 +338,7 @@ var StaticBody = new Class({ * [description] * * @name Phaser.Physics.Arcade.StaticBody#wasTouching - * @type {object} + * @type {ArcadeBodyCollision} * @since 3.0.0 */ this.wasTouching = { none: true, up: false, down: false, left: false, right: false }; @@ -347,7 +347,7 @@ var StaticBody = new Class({ * [description] * * @name Phaser.Physics.Arcade.StaticBody#blocked - * @type {object} + * @type {ArcadeBodyCollision} * @since 3.0.0 */ this.blocked = { none: true, up: false, down: false, left: false, right: false }; @@ -564,9 +564,9 @@ var StaticBody = new Class({ * @method Phaser.Physics.Arcade.StaticBody#getBounds * @since 3.0.0 * - * @param {object} obj - [description] + * @param {ArcadeBodyBounds} obj - [description] * - * @return {object} [description] + * @return {ArcadeBodyBounds} [description] */ getBounds: function (obj) { diff --git a/src/physics/arcade/StaticPhysicsGroup.js b/src/physics/arcade/StaticPhysicsGroup.js index 2de4a5d1d..9c1d080d1 100644 --- a/src/physics/arcade/StaticPhysicsGroup.js +++ b/src/physics/arcade/StaticPhysicsGroup.js @@ -24,7 +24,7 @@ var Group = require('../../gameobjects/group/Group'); * @param {Phaser.Physics.Arcade.World} world - [description] * @param {Phaser.Scene} scene - [description] * @param {array} children - [description] - * @param {object} config - [description] + * @param {GroupConfig} config - [description] */ var StaticPhysicsGroup = new Class({ diff --git a/src/physics/arcade/World.js b/src/physics/arcade/World.js index 8503f8016..c32a22242 100644 --- a/src/physics/arcade/World.js +++ b/src/physics/arcade/World.js @@ -27,6 +27,64 @@ var TileIntersectsBody = require('./tilemap/TileIntersectsBody'); var Vector2 = require('../../math/Vector2'); var Wrap = require('../../math/Wrap'); +/** + * @typedef {object} ArcadeWorldConfig + * + * @property {object} [gravity] - [description] + * @property {number} [gravity.x=0] - [description] + * @property {number} [gravity.y=0] - [description] + * @property {number} [x=0] - [description] + * @property {number} [y=0] - [description] + * @property {number} [width=0] - [description] + * @property {number} [height=0] - [description] + * @property {object} [checkCollision] - [description] + * @property {boolean} [checkCollision.up=true] - [description] + * @property {boolean} [checkCollision.down=true] - [description] + * @property {boolean} [checkCollision.left=true] - [description] + * @property {boolean} [checkCollision.right=true] - [description] + * @property {number} [overlapBias=4] - [description] + * @property {number} [tileBias=16] - [description] + * @property {boolean} [forceX=false] - [description] + * @property {boolean} [isPaused=false] - [description] + * @property {boolean} [debug=false] - [description] + * @property {boolean} [debugShowBody=true] - [description] + * @property {boolean} [debugShowStaticBody=true] - [description] + * @property {boolean} [debugShowVelocity=true] - [description] + * @property {number} [debugBodyColor=0xff00ff] - [description] + * @property {number} [debugStaticBodyColor=0x0000ff] - [description] + * @property {number} [debugVelocityColor=0x00ff00] - [description] + * @property {number} [maxEntries=16] - [description] + */ + +/** + * @typedef {object} CheckCollisionObject + * + * @property {boolean} up - [description] + * @property {boolean} down - [description] + * @property {boolean} left - [description] + * @property {boolean} right - [description] + */ + +/** + * @typedef {object} ArcadeWorldDefaults + * + * @property {boolean} debugShowBody - [description] + * @property {boolean} debugShowStaticBody - [description] + * @property {boolean} debugShowVelocity - [description] + * @property {number} bodyDebugColor - [description] + * @property {number} staticBodyDebugColor - [description] + * @property {number} velocityDebugColor - [description] + */ + +/** + * @typedef {object} ArcadeWorldTreeMinMax + * + * @property {number} minX - [description] + * @property {number} minY - [description] + * @property {number} maxX - [description] + * @property {number} maxY - [description] + */ + /** * @classdesc * [description] @@ -38,7 +96,7 @@ var Wrap = require('../../math/Wrap'); * @since 3.0.0 * * @param {Phaser.Scene} scene - [description] - * @param {object} config - [description] + * @param {ArcadeWorldConfig} config - [description] */ var World = new Class({ @@ -122,7 +180,7 @@ var World = new Class({ * [description] * * @name Phaser.Physics.Arcade.World#checkCollision - * @type {object} + * @type {CheckCollisionObject} * @since 3.0.0 */ this.checkCollision = { @@ -206,7 +264,7 @@ var World = new Class({ * [description] * * @name Phaser.Physics.Arcade.World#defaults - * @type {object} + * @type {ArcadeWorldDefaults} * @since 3.0.0 */ this.defaults = { @@ -214,7 +272,7 @@ var World = new Class({ debugShowStaticBody: GetValue(config, 'debugShowStaticBody', true), debugShowVelocity: GetValue(config, 'debugShowVelocity', true), bodyDebugColor: GetValue(config, 'debugBodyColor', 0xff00ff), - staticBodyDebugColor: GetValue(config, 'debugBodyColor', 0x0000ff), + staticBodyDebugColor: GetValue(config, 'debugStaticBodyColor', 0x0000ff), velocityDebugColor: GetValue(config, 'debugVelocityColor', 0x00ff00) }; @@ -250,7 +308,7 @@ var World = new Class({ * [description] * * @name Phaser.Physics.Arcade.World#treeMinMax - * @type {object} + * @type {ArcadeWorldTreeMinMax} * @since 3.0.0 */ this.treeMinMax = { minX: 0, minY: 0, maxX: 0, maxY: 0 }; @@ -567,7 +625,7 @@ var World = new Class({ * @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for collision. * @param {ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects collide. * @param {ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects collide. Must return a boolean. - * @param {object} [callbackContext] - The scope in which to call the callbacks. + * @param {*} [callbackContext] - The scope in which to call the callbacks. * * @return {Phaser.Physics.Arcade.Collider} The Collider that was created. */ @@ -594,7 +652,7 @@ var World = new Class({ * @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for overlap. * @param {ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects overlap. * @param {ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects overlap. Must return a boolean. - * @param {object} [callbackContext] - The scope in which to call the callbacks. + * @param {*} [callbackContext] - The scope in which to call the callbacks. * * @return {Phaser.Physics.Arcade.Collider} The Collider that was created. */ @@ -865,9 +923,9 @@ var World = new Class({ * * @param {Phaser.Physics.Arcade.Body} body1 - [description] * @param {Phaser.Physics.Arcade.Body} body2 - [description] - * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {object} callbackContext - [description] - * @param {boolean} overlapOnly - [description] + * @param {ArcadePhysicsCallback} [processCallback] - [description] + * @param {*} [callbackContext] - [description] + * @param {boolean} [overlapOnly] - [description] * * @return {boolean} [description] */ @@ -1251,7 +1309,7 @@ var World = new Class({ * @param {Phaser.GameObjects.GameObject} object2 - [description] * @param {ArcadePhysicsCallback} [overlapCallback] - [description] * @param {ArcadePhysicsCallback} [processCallback] - [description] - * @param {object} [callbackContext] - [description] + * @param {*} [callbackContext] - [description] * * @return {boolean} [description] */ @@ -1274,7 +1332,7 @@ var World = new Class({ * @param {Phaser.GameObjects.GameObject} object2 - [description] * @param {ArcadePhysicsCallback} [collideCallback] - [description] * @param {ArcadePhysicsCallback} [processCallback] - [description] - * @param {object} [callbackContext] - [description] + * @param {*} [callbackContext] - [description] * * @return {boolean} [description] */ @@ -1297,7 +1355,7 @@ var World = new Class({ * @param {Phaser.GameObjects.GameObject} object2 - [description] * @param {ArcadePhysicsCallback} collideCallback - [description] * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {object} callbackContext - [description] + * @param {*} callbackContext - [description] * @param {boolean} overlapOnly - [description] * * @return {boolean} [description] @@ -1358,7 +1416,7 @@ var World = new Class({ * @param {Phaser.GameObjects.GameObject} object2 - [description] * @param {ArcadePhysicsCallback} collideCallback - [description] * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {object} callbackContext - [description] + * @param {*} callbackContext - [description] * @param {boolean} overlapOnly - [description] * * @return {boolean} [description] @@ -1436,7 +1494,7 @@ var World = new Class({ * @param {Phaser.GameObjects.GameObject} sprite2 - [description] * @param {ArcadePhysicsCallback} collideCallback - [description] * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {object} callbackContext - [description] + * @param {*} callbackContext - [description] * @param {boolean} overlapOnly - [description] * * @return {boolean} [description] @@ -1471,7 +1529,7 @@ var World = new Class({ * @param {Phaser.GameObjects.Group} group - [description] * @param {ArcadePhysicsCallback} collideCallback - [description] * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {object} callbackContext - [description] + * @param {*} callbackContext - [description] * @param {boolean} overlapOnly - [description] * * @return {boolean} [description] @@ -1534,7 +1592,7 @@ var World = new Class({ * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - [description] * @param {ArcadePhysicsCallback} collideCallback - [description] * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {object} callbackContext - [description] + * @param {*} callbackContext - [description] * @param {boolean} overlapOnly - [description] * * @return {boolean} [description] @@ -1574,7 +1632,7 @@ var World = new Class({ * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - [description] * @param {ArcadePhysicsCallback} collideCallback - [description] * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {object} callbackContext - [description] + * @param {*} callbackContext - [description] * @param {boolean} overlapOnly - [description] * * @return {boolean} [description] @@ -1673,7 +1731,7 @@ var World = new Class({ * @param {Phaser.GameObjects.Group} group2 - [description] * @param {ArcadePhysicsCallback} collideCallback - [description] * @param {ArcadePhysicsCallback} processCallback - [description] - * @param {object} callbackContext - [description] + * @param {*} callbackContext - [description] * @param {boolean} overlapOnly - [description] * * @return {boolean} [description] diff --git a/src/physics/impact/Body.js b/src/physics/impact/Body.js index 48df4b383..114063edb 100644 --- a/src/physics/impact/Body.js +++ b/src/physics/impact/Body.js @@ -16,6 +16,25 @@ var UpdateMotion = require('./UpdateMotion'); * @param {Phaser.Physics.Impact.Body} body - [description] */ +/** + * @typedef {object} JSONImpactBody + * @todo Replace object types + * + * @property {string} name - [description] + * @property {object} size - [description] + * @property {object} pos - [description] + * @property {object} vel - [description] + * @property {object} accel - [description] + * @property {object} friction - [description] + * @property {object} maxVel - [description] + * @property {number} gravityFactor - [description] + * @property {number} bounciness - [description] + * @property {number} minBounceVelocity - [description] + * @property {Phaser.Physics.Impact.TYPE} type - [description] + * @property {Phaser.Physics.Impact.TYPE} checkAgainst - [description] + * @property {Phaser.Physics.Impact.COLLIDES} collides - [description] + */ + /** * @classdesc * An Impact.js compatible physics body. @@ -490,7 +509,7 @@ var Body = new Class({ * @method Phaser.Physics.Impact.Body#toJSON * @since 3.0.0 * - * @return {object} [description] + * @return {JSONImpactBody} [description] */ toJSON: function () { diff --git a/src/physics/impact/World.js b/src/physics/impact/World.js index 92c129649..bef652fc8 100644 --- a/src/physics/impact/World.js +++ b/src/physics/impact/World.js @@ -16,6 +16,62 @@ var Solver = require('./Solver'); var TILEMAP_FORMATS = require('../../tilemaps/Formats'); var TYPE = require('./TYPE'); +/** + * @typedef {object} ImpactWorldConfig + * + * @property {number} [gravity=0] - [description] + * @property {number} [cellSize=64] - [description] + * @property {number} [timeScale=1] - [description] + * @property {float} [maxStep=0.05] - [description] + * @property {number} [gravity=0] - [description] + * @property {boolean} [debug=false] - [description] + * @property {number} [maxVelocity=100] - [description] + * @property {boolean} [debugShowBody=true] - [description] + * @property {boolean} [debugShowVelocity=true] - [description] + * @property {number} [debugBodyColor=0xff00ff] - [description] + * @property {number} [debugVelocityColor=0x00ff00] - [description] + * @property {number} [maxVelocityX=maxVelocity] - [description] + * @property {number} [maxVelocityY=maxVelocity] - [description] + * @property {number} [minBounceVelocity=40] - [description] + * @property {number} [gravityFactor=1] - [description] + * @property {number} [bounciness=0] - [description] + * @property {(object|boolean)} [setBounds] - [description] + * @property {number} [setBounds.x=0] - [description] + * @property {number} [setBounds.y=0] - [description] + * @property {number} [setBounds.x=0] - [description] + * @property {number} [setBounds.width] - [description] + * @property {number} [setBounds.height] - [description] + * @property {number} [setBounds.thickness=64] - [description] + * @property {boolean} [setBounds.left=true] - [description] + * @property {boolean} [setBounds.right=true] - [description] + * @property {boolean} [setBounds.top=true] - [description] + * @property {boolean} [setBounds.bottom=true] - [description] + */ + +/** + * An object containing the 4 wall bodies that bound the physics world. + * @typedef {object} ImpactWorldDefaults + * + * @property {boolean} debugShowBody - [description] + * @property {boolean} debugShowVelocity - [description] + * @property {number} bodyDebugColor - [description] + * @property {number} velocityDebugColor - [description] + * @property {number} maxVelocityX - [description] + * @property {number} maxVelocityY - [description] + * @property {number} minBounceVelocity - [description] + * @property {number} gravityFactor - [description] + * @property {number} bounciness - [description] + */ + +/** + * @typedef {object} ImpactWorldWalls + * + * @property {?Phaser.Physics.Impact.Body} left - [description] + * @property {?Phaser.Physics.Impact.Body} right - [description] + * @property {?Phaser.Physics.Impact.Body} top - [description] + * @property {?Phaser.Physics.Impact.Body} bottom - [description] + */ + /** * @classdesc * [description] @@ -27,7 +83,7 @@ var TYPE = require('./TYPE'); * @since 3.0.0 * * @param {Phaser.Scene} scene - [description] - * @param {object} config - [description] + * @param {ImpactWorldConfig} config - [description] */ var World = new Class({ @@ -140,7 +196,7 @@ var World = new Class({ * [description] * * @name Phaser.Physics.Impact.World#defaults - * @type {object} + * @type {ImpactWorldDefaults} * @since 3.0.0 */ this.defaults = { @@ -159,7 +215,7 @@ var World = new Class({ * An object containing the 4 wall bodies that bound the physics world. * * @name Phaser.Physics.Impact.World#walls - * @type {object} + * @type {ImpactWorldWalls} * @since 3.0.0 */ this.walls = { left: null, right: null, top: null, bottom: null }; diff --git a/src/physics/impact/components/Collides.js b/src/physics/impact/components/Collides.js index 85963fde4..3139e8c42 100644 --- a/src/physics/impact/components/Collides.js +++ b/src/physics/impact/components/Collides.js @@ -32,7 +32,7 @@ var Collides = { * @since 3.0.0 * * @param {CollideCallback} callback - [description] - * @param {object} scope - [description] + * @param {*} scope - [description] * * @return {Phaser.GameObjects.GameObject} This Game Object. */ diff --git a/src/renderer/canvas/CanvasRenderer.js b/src/renderer/canvas/CanvasRenderer.js index 203d87f33..c88878e31 100644 --- a/src/renderer/canvas/CanvasRenderer.js +++ b/src/renderer/canvas/CanvasRenderer.js @@ -80,7 +80,7 @@ var CanvasRenderer = new Class({ * [description] * * @name Phaser.Renderer.Canvas.CanvasRenderer#config - * @type {object} + * @type {RendererConfig} * @since 3.0.0 */ this.config = { diff --git a/src/renderer/index.js b/src/renderer/index.js index 5fa7f0c31..15b7a53c1 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -4,6 +4,17 @@ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +/** + * @typedef {object} RendererConfig + * + * @property {boolean} clearBeforeRender - [description] + * @property {boolean} pixelArt - [description] + * @property {Phaser.Display.Color} backgroundColor - [description] + * @property {number} resolution - [description] + * @property {boolean} autoResize - [description] + * @property {boolean} roundPixels - [description] + */ + /** * @namespace Phaser.Renderer */ diff --git a/src/renderer/webgl/WebGLRenderer.js b/src/renderer/webgl/WebGLRenderer.js index 8b5c59912..4da258094 100644 --- a/src/renderer/webgl/WebGLRenderer.js +++ b/src/renderer/webgl/WebGLRenderer.js @@ -22,6 +22,14 @@ var TextureTintPipeline = require('./pipelines/TextureTintPipeline'); * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description] */ +/** + * @typedef {object} SnapshotState + * + * @property {SnapshotCallback} callback - [description] + * @property {string} type - [description] + * @property {float} encoder - [description] + */ + /** * @classdesc * [description] @@ -59,7 +67,7 @@ var WebGLRenderer = new Class({ * [description] * * @name Phaser.Renderer.WebGL.WebGLRenderer#config - * @type {object} + * @type {RendererConfig} * @since 3.0.0 */ this.config = { @@ -179,7 +187,7 @@ var WebGLRenderer = new Class({ * [description] * * @name Phaser.Renderer.WebGL.WebGLRenderer#snapshotState - * @type {object} + * @type {SnapshotState} * @since 3.0.0 */ this.snapshotState = { diff --git a/src/scene/Scene.js b/src/scene/Scene.js index 9256c477b..5bd4c3ee3 100644 --- a/src/scene/Scene.js +++ b/src/scene/Scene.js @@ -7,6 +7,12 @@ var Class = require('../utils/Class'); var Systems = require('./Systems'); +/** + * @typedef {object} SceneConfig + * + * @property + */ + /** * @classdesc * [description] @@ -16,7 +22,7 @@ var Systems = require('./Systems'); * @constructor * @since 3.0.0 * - * @param {object} config - [description] + * @param {(string|SettingsConfig)} config - Scene specific configuration settings. */ var Scene = new Class({ diff --git a/src/scene/SceneManager.js b/src/scene/SceneManager.js index 81409a94b..e6feb53df 100644 --- a/src/scene/SceneManager.js +++ b/src/scene/SceneManager.js @@ -257,7 +257,7 @@ var SceneManager = new Class({ * @since 3.0.0 * * @param {string} key - A unique key used to reference the Scene, i.e. `MainMenu` or `Level1`. - * @param {(Phaser.Scene|object|function)} sceneConfig - [description] + * @param {(Phaser.Scene|SettingsConfig|function)} sceneConfig - [description] * @param {boolean} [autoStart=false] - If `true` the Scene will be started immediately after being added. * * @return {?Phaser.Scene} [description] @@ -430,7 +430,7 @@ var SceneManager = new Class({ * @private * @since 3.0.0 * - * @param {object} loader - [description] + * @param {Phaser.Loader.LoaderPlugin} loader - [description] */ loadComplete: function (loader) { @@ -446,7 +446,7 @@ var SceneManager = new Class({ * @private * @since 3.0.0 * - * @param {object} loader - [description] + * @param {Phaser.Loader.LoaderPlugin} loader - [description] */ payloadComplete: function (loader) { @@ -632,7 +632,7 @@ var SceneManager = new Class({ * @since 3.0.0 * * @param {string} key - [description] - * @param {object} sceneConfig - [description] + * @param {(string|SettingsConfig)} sceneConfig - [description] * * @return {Phaser.Scene} [description] */ @@ -706,7 +706,7 @@ var SceneManager = new Class({ * @since 3.0.0 * * @param {string} key - [description] - * @param {(Phaser.Scene|object|function)} sceneConfig - [description] + * @param {(Phaser.Scene|SettingsConfig|function)} sceneConfig - [description] * * @return {string} [description] */ diff --git a/src/scene/ScenePlugin.js b/src/scene/ScenePlugin.js index a4ece37e8..76514468c 100644 --- a/src/scene/ScenePlugin.js +++ b/src/scene/ScenePlugin.js @@ -52,7 +52,7 @@ var ScenePlugin = new Class({ * [description] * * @name Phaser.Scenes.ScenePlugin#settings - * @type {object} + * @type {SettingsObject} * @since 3.0.0 */ this.settings = scene.sys.settings; diff --git a/src/scene/Settings.js b/src/scene/Settings.js index aaa7b8c08..1993ca08f 100644 --- a/src/scene/Settings.js +++ b/src/scene/Settings.js @@ -9,17 +9,48 @@ var GetValue = require('../utils/object/GetValue'); var InjectionMap = require('./InjectionMap'); /** - * Takes a Scene configuration object and returns a fully formed Systems object. + * @typedef {object} SettingsConfig * - * @function Phaser.Scenes.Settings.create - * @since 3.0.0 - * - * @param {object} config - [description] - * - * @return {object} [description] + * @property {string} [key] - [description] + * @property {boolean} [active=false] - [description] + * @property {boolean} [visible=true] - [description] + * @property {(false|[type])} [files=false] - [description] + * @property {?[type]} [cameras=null] - [description] + * @property {Object.} [map] - [description] + * @property {object} [physics={}] - [description] + * @property {object} [loader={}] - [description] + * @property {(false|[type])} [plugins=false] - [description] */ + +/** + * @typedef {object} SettingsObject + * + * @property {number} status - [description] + * @property {string} key - [description] + * @property {boolean} active - [description] + * @property {boolean} visible - [description] + * @property {boolean} isBooted - [description] + * @property {object} data - [description] + * @property {(false|[type])} files - [description] + * @property {?[type]} cameras - [description] + * @property {Object.} map - [description] + * @property {object} physics - [description] + * @property {object} loader - [description] + * @property {(false|[type])} plugins - [description] + */ + var Settings = { + /** + * Takes a Scene configuration object and returns a fully formed Systems object. + * + * @function Phaser.Scenes.Settings.create + * @since 3.0.0 + * + * @param {(string|SettingsConfig)} config - [description] + * + * @return {SettingsObject} [description] + */ create: function (config) { if (typeof config === 'string') diff --git a/src/scene/Systems.js b/src/scene/Systems.js index 82e60ecee..dc067d0be 100644 --- a/src/scene/Systems.js +++ b/src/scene/Systems.js @@ -25,7 +25,7 @@ var Settings = require('./Settings'); * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene that owns this Systems instance. - * @param {object} config - Scene specific configuration settings. + * @param {(string|SettingsConfig)} config - Scene specific configuration settings. */ var Systems = new Class({ @@ -55,7 +55,7 @@ var Systems = new Class({ * [description] * * @name Phaser.Scenes.Systems#config - * @type {object} + * @type {(string|SettingsConfig)} * @since 3.0.0 */ this.config = config; @@ -64,7 +64,7 @@ var Systems = new Class({ * [description] * * @name Phaser.Scenes.Systems#settings - * @type {object} + * @type {SettingsObject} * @since 3.0.0 */ this.settings = Settings.create(config); diff --git a/src/sound/BaseSound.js b/src/sound/BaseSound.js index f1cab5b41..e2929868a 100644 --- a/src/sound/BaseSound.js +++ b/src/sound/BaseSound.js @@ -203,10 +203,10 @@ var BaseSound = new Class({ this.config = Extend(this.config, config); /** - * Object containing markers definitions (Object.). + * Object containing markers definitions. * * @name Phaser.Sound.BaseSound#markers - * @type {object} + * @type {Object.} * @default {} * @readOnly * @since 3.0.0 diff --git a/src/sound/BaseSoundManager.js b/src/sound/BaseSoundManager.js index 475bb8e02..a7bc0fd7a 100644 --- a/src/sound/BaseSoundManager.js +++ b/src/sound/BaseSoundManager.js @@ -18,6 +18,15 @@ var NOOP = require('../utils/NOOP'); * @param {Phaser.Sound.BaseSound[]} sounds - [description] */ +/** + * Audio sprite sound type. + * + * @typedef {Phaser.Sound.BaseSound} AudioSpriteSound + * + * @property {object} spritemap - Local reference to 'spritemap' object form json file generated by audiosprite tool. + */ + + /** * @classdesc * The sound manager is responsible for playing back audio via Web Audio API or HTML Audio tag as fallback. @@ -181,14 +190,6 @@ var BaseSoundManager = new Class({ */ add: NOOP, - /** - * Audio sprite sound type. - * - * @typedef {Phaser.Sound.BaseSound} AudioSpriteSound - * - * @property {object} spritemap - Local reference to 'spritemap' object form json file generated by audiosprite tool. - */ - /** * Adds a new audio sprite sound into the sound manager. * @@ -513,7 +514,7 @@ var BaseSoundManager = new Class({ * @since 3.0.0 * * @param {EachActiveSoundCallback} callback - Callback function. (sound: ISound, index: number, array: ISound[]) => void - * @param {object} [scope] - Callback context. + * @param {*} [scope] - Callback context. */ forEachActiveSound: function (callback, scope) { diff --git a/src/time/Clock.js b/src/time/Clock.js index 6e873ea0d..7ebe32d87 100644 --- a/src/time/Clock.js +++ b/src/time/Clock.js @@ -136,7 +136,7 @@ var Clock = new Class({ * @method Phaser.Time.Clock#addEvent * @since 3.0.0 * - * @param {object} config - [description] + * @param {TimerEventConfig} config - [description] * * @return {Phaser.Time.TimerEvent} [description] */ @@ -157,8 +157,8 @@ var Clock = new Class({ * * @param {number} delay - [description] * @param {function} callback - [description] - * @param {array} args - [description] - * @param {object} callbackScope - [description] + * @param {*[]} args - [description] + * @param {*} callbackScope - [description] * * @return {Phaser.Time.TimerEvent} [description] */ diff --git a/src/time/TimerEvent.js b/src/time/TimerEvent.js index d10393eef..10c0d3df0 100644 --- a/src/time/TimerEvent.js +++ b/src/time/TimerEvent.js @@ -7,6 +7,20 @@ var Class = require('../utils/Class'); var GetFastValue = require('../utils/object/GetFastValue'); +/** + * @typedef {object} TimerEventConfig + * + * @property {number} [delay=0] - [description] + * @property {number} [repeat=0] - [description] + * @property {boolean} [loop=false] - [description] + * @property {function} [callback] - [description] + * @property {*} [callbackScope] - [description] + * @property {*[]} [args] - [description] + * @property {number} [timeScale=1] - [description] + * @property {number} [startAt=1] - [description] + * @property {boolean} [paused=false] - [description] + */ + /** * @classdesc * [description] @@ -16,7 +30,7 @@ var GetFastValue = require('../utils/object/GetFastValue'); * @constructor * @since 3.0.0 * - * @param {object} config - [description] + * @param {TimerEventConfig} config - [description] */ var TimerEvent = new Class({ @@ -153,7 +167,7 @@ var TimerEvent = new Class({ * @method Phaser.Time.TimerEvent#reset * @since 3.0.0 * - * @param {object} config - [description] + * @param {TimerEventConfig} config - [description] * * @return {Phaser.Time.TimerEvent} This TimerEvent object. */ diff --git a/src/utils/object/GetFastValue.js b/src/utils/object/GetFastValue.js index 72bebfbe1..309e07604 100644 --- a/src/utils/object/GetFastValue.js +++ b/src/utils/object/GetFastValue.js @@ -16,7 +16,7 @@ * * @param {object} source - [description] * @param {string} key - [description] - * @param {*} defaultValue - [description] + * @param {*} [defaultValue] - [description] * * @return {*} [description] */