mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 13:43:26 +00:00
More jsdoc updates
This commit is contained in:
parent
9e8ee078e8
commit
99913b9da4
6 changed files with 313 additions and 39 deletions
|
@ -1,15 +1,41 @@
|
|||
var Class = require('../utils/Class');
|
||||
var PluginManager = require('../plugins/PluginManager');
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @class GameObjectFactory
|
||||
* @memberOf Phaser.GameObjects
|
||||
* @constructor
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Scene} scene - The Scene to which this Game Object belongs.
|
||||
*/
|
||||
var GameObjectFactory = new Class({
|
||||
|
||||
initialize:
|
||||
|
||||
function GameObjectFactory (scene)
|
||||
{
|
||||
// The Scene that owns this plugin
|
||||
/**
|
||||
* The Scene to which this Game Object belongs.
|
||||
* Game Objects can only belong to one Scene.
|
||||
*
|
||||
* @name Phaser.GameObjects.GameObjectFactory#scene
|
||||
* @type {Phaser.Scene}
|
||||
* @protected
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.scene = scene;
|
||||
|
||||
/**
|
||||
* A reference to the Scene.Systems.
|
||||
*
|
||||
* @name Phaser.GameObjects.GameObjectFactory#systems
|
||||
* @type {Phaser.Scenes.Systems}
|
||||
* @protected
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.systems = scene.sys;
|
||||
|
||||
if (!scene.sys.settings.isBooted)
|
||||
|
@ -18,9 +44,17 @@ var GameObjectFactory = new Class({
|
|||
}
|
||||
|
||||
this.displayList;
|
||||
|
||||
this.updateList;
|
||||
},
|
||||
|
||||
/**
|
||||
* Boots the plugin.
|
||||
*
|
||||
* @method Phaser.GameObjects.GameObjectFactory#boot
|
||||
* @private
|
||||
* @since 3.0.0
|
||||
*/
|
||||
boot: function ()
|
||||
{
|
||||
this.displayList = this.systems.displayList;
|
||||
|
@ -32,6 +66,19 @@ var GameObjectFactory = new Class({
|
|||
eventEmitter.on('destroy', this.destroy, this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds an existing Game Object to this Scene.
|
||||
*
|
||||
* If the Game Object renders, it will be added to the Display List.
|
||||
* If it has a `preUpdate` method, it will be added to the Update List.
|
||||
*
|
||||
* @method Phaser.GameObjects.GameObjectFactory#existing
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.GameObjects.GameObject} child - The child to be added to this Scene.
|
||||
*
|
||||
* @return {Phaser.GameObjects.GameObject} The Game Object that was added.
|
||||
*/
|
||||
existing: function (child)
|
||||
{
|
||||
if (child.renderCanvas || child.renderWebGL)
|
||||
|
@ -47,11 +94,22 @@ var GameObjectFactory = new Class({
|
|||
return child;
|
||||
},
|
||||
|
||||
/**
|
||||
* Shuts this plugin down.
|
||||
*
|
||||
* @method Phaser.GameObjects.GameObjectFactory#shutdown
|
||||
* @since 3.0.0
|
||||
*/
|
||||
shutdown: function ()
|
||||
{
|
||||
// TODO
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroys this plugin.
|
||||
*
|
||||
* @method Phaser.GameObjects.GameObjectFactory#destroy
|
||||
* @since 3.0.0
|
||||
*/
|
||||
destroy: function ()
|
||||
{
|
||||
this.scene = null;
|
||||
|
|
|
@ -125,19 +125,18 @@ var Blitter = new Class({
|
|||
return bob;
|
||||
},
|
||||
|
||||
// frame MUST be part of the Blitter texture
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.GameObjects.Blitter#createFromCallback
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {[type]} callback - [description]
|
||||
* @param {[type]} quantity - [description]
|
||||
* @param {[type]} frame - [description]
|
||||
* @param {[type]} visible - [description]
|
||||
* @param {function} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob.
|
||||
* @param {integer} quantity - The quantity of Bob objects to create.
|
||||
* @param {string} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture.
|
||||
* @param {boolean} [visible=true] - [description]
|
||||
*
|
||||
* @return {[type]} [description]
|
||||
* @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that were created.
|
||||
*/
|
||||
createFromCallback: function (callback, quantity, frame, visible)
|
||||
{
|
||||
|
@ -153,18 +152,17 @@ var Blitter = new Class({
|
|||
return bobs;
|
||||
},
|
||||
|
||||
// frame MUST be part of the Blitter texture
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.GameObjects.Blitter#createMultiple
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {[type]} quantity - [description]
|
||||
* @param {[type]} frame - [description]
|
||||
* @param {[type]} visible - [description]
|
||||
* @param {integer} quantity - The quantity of Bob objects to create.
|
||||
* @param {string} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture.
|
||||
* @param {boolean} [visible=true] - [description]
|
||||
*
|
||||
* @return {[type]} [description]
|
||||
* @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that were created.
|
||||
*/
|
||||
createMultiple: function (quantity, frame, visible)
|
||||
{
|
||||
|
@ -196,9 +194,9 @@ var Blitter = new Class({
|
|||
* @method Phaser.GameObjects.Blitter#childCanRender
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {[type]} child - [description]
|
||||
* @param {Phaser.GameObjects.Blitter.Bob} child - [description]
|
||||
*
|
||||
* @return {[type]} [description]
|
||||
* @return {boolean} [description]
|
||||
*/
|
||||
childCanRender: function (child)
|
||||
{
|
||||
|
|
|
@ -3,8 +3,18 @@ var BuildGameObject = require('../BuildGameObject');
|
|||
var GameObjectCreator = require('../GameObjectCreator');
|
||||
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
|
||||
|
||||
// When registering a factory function 'this' refers to the GameObjectCreator context.
|
||||
|
||||
/**
|
||||
* Creates a new Blitter Game Object and returns it.
|
||||
*
|
||||
* Note: This method will only be available if the Blitter Game Object has been built into Phaser.
|
||||
*
|
||||
* @method Phaser.GameObjects.GameObjectCreator#blitter
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {object} config - [description]
|
||||
*
|
||||
* @return {Phaser.GameObjects.Blitter} The Game Object that was created.
|
||||
*/
|
||||
GameObjectCreator.register('blitter', function (config)
|
||||
{
|
||||
var key = GetAdvancedValue(config, 'key', null);
|
||||
|
@ -16,3 +26,5 @@ GameObjectCreator.register('blitter', function (config)
|
|||
|
||||
return blitter;
|
||||
});
|
||||
|
||||
// When registering a factory function 'this' refers to the GameObjectCreator context.
|
||||
|
|
|
@ -1,6 +1,26 @@
|
|||
var Blitter = require('./Blitter');
|
||||
var GameObjectFactory = require('../GameObjectFactory');
|
||||
|
||||
/**
|
||||
* Creates a new Blitter Game Object and adds it to the Scene.
|
||||
*
|
||||
* Note: This method will only be available if the Blitter Game Object has been built into Phaser.
|
||||
*
|
||||
* @method Phaser.GameObjects.GameObjectFactory#blitter
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {number} x - The x position of the Game Object.
|
||||
* @param {number} y - The y position of the Game Object.
|
||||
* @param {string} key - The key of the Texture the Blitter object will use.
|
||||
* @param {string|integer} [frame] - The default Frame children of the Blitter will use.
|
||||
*
|
||||
* @return {Phaser.GameObjects.Blitter} The Game Object that was created.
|
||||
*/
|
||||
GameObjectFactory.register('blitter', function (x, y, key, frame)
|
||||
{
|
||||
return this.displayList.add(new Blitter(this.scene, x, y, key, frame));
|
||||
});
|
||||
|
||||
// When registering a factory function 'this' refers to the GameObjectFactory context.
|
||||
//
|
||||
// There are several properties available to use:
|
||||
|
@ -8,8 +28,3 @@ var GameObjectFactory = require('../GameObjectFactory');
|
|||
// this.scene - a reference to the Scene that owns the GameObjectFactory
|
||||
// this.displayList - a reference to the Display List the Scene owns
|
||||
// this.updateList - a reference to the Update List the Scene owns
|
||||
|
||||
GameObjectFactory.register('blitter', function (x, y, key, frame)
|
||||
{
|
||||
return this.displayList.add(new Blitter(this.scene, x, y, key, frame));
|
||||
});
|
||||
|
|
|
@ -1,25 +1,121 @@
|
|||
var Class = require('../../utils/Class');
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @class Bob
|
||||
* @memberOf Phaser.GameObjects.Blitter
|
||||
* @constructor
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.GameObjects.Blitter} blitter - [description]
|
||||
* @param {number} x - [description]
|
||||
* @param {number} y - [description]
|
||||
* @param {string|integer} frame - [description]
|
||||
* @param {boolean} visible - [description]
|
||||
*/
|
||||
var Bob = new Class({
|
||||
|
||||
initialize:
|
||||
|
||||
function Bob (blitter, x, y, frame, visible)
|
||||
{
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @name Phaser.GameObjects.Blitter.Bob#parent
|
||||
* @type {Phaser.GameObjects.Blitter}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.parent = blitter;
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @name Phaser.GameObjects.Blitter.Bob#x
|
||||
* @type {number}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.x = x;
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @name Phaser.GameObjects.Blitter.Bob#y
|
||||
* @type {number}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.y = y;
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @name Phaser.GameObjects.Blitter.Bob#frame
|
||||
* @type {string|integer}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.frame = frame;
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @name Phaser.GameObjects.Blitter.Bob#data
|
||||
* @type {object}
|
||||
* @default {}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.data = {};
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @name Phaser.GameObjects.Blitter.Bob#_visible
|
||||
* @type {boolean}
|
||||
* @private
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this._visible = visible;
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @name Phaser.GameObjects.Blitter.Bob#_alpha
|
||||
* @type {number}
|
||||
* @private
|
||||
* @default 1
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this._alpha = 1;
|
||||
|
||||
this.flipX - false;
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @name Phaser.GameObjects.Blitter.Bob#flipX
|
||||
* @type {boolean}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.flipX = false;
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @name Phaser.GameObjects.Blitter.Bob#flipY
|
||||
* @type {boolean}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.flipY = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.GameObjects.Blitter.Bob#setFrame
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {[type]} frame - [description]
|
||||
*
|
||||
* @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object.
|
||||
*/
|
||||
setFrame: function (frame)
|
||||
{
|
||||
if (frame === undefined)
|
||||
|
@ -34,19 +130,53 @@ var Bob = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.GameObjects.Blitter.Bob#resetFlip
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object.
|
||||
*/
|
||||
resetFlip: function ()
|
||||
{
|
||||
this.flipX = false;
|
||||
this.flipY = false;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.GameObjects.Blitter.Bob#reset
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {[type]} x - [description]
|
||||
* @param {[type]} y - [description]
|
||||
* @param {[type]} frame - [description]
|
||||
*
|
||||
* @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object.
|
||||
*/
|
||||
reset: function (x, y, frame)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.frame = frame;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.GameObjects.Blitter.Bob#setFlipX
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {[type]} value - [description]
|
||||
*
|
||||
* @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object.
|
||||
*/
|
||||
setFlipX: function (value)
|
||||
{
|
||||
this.flipX = value;
|
||||
|
@ -54,6 +184,16 @@ var Bob = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.GameObjects.Blitter.Bob#setFlipY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {[type]} value - [description]
|
||||
*
|
||||
* @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object.
|
||||
*/
|
||||
setFlipY: function (value)
|
||||
{
|
||||
this.flipY = value;
|
||||
|
@ -61,6 +201,17 @@ var Bob = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.GameObjects.Blitter.Bob#setFlip
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {[type]} x - [description]
|
||||
* @param {[type]} y - [description]
|
||||
*
|
||||
* @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object.
|
||||
*/
|
||||
setFlip: function (x, y)
|
||||
{
|
||||
this.flipX = x;
|
||||
|
@ -69,6 +220,16 @@ var Bob = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.GameObjects.Blitter.Bob#setVisible
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {[type]} value - [description]
|
||||
*
|
||||
* @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object.
|
||||
*/
|
||||
setVisible: function (value)
|
||||
{
|
||||
this.visible = value;
|
||||
|
@ -76,6 +237,16 @@ var Bob = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.GameObjects.Blitter.Bob#setAlpha
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {[type]} value - [description]
|
||||
*
|
||||
* @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object.
|
||||
*/
|
||||
setAlpha: function (value)
|
||||
{
|
||||
this.alpha = value;
|
||||
|
@ -83,6 +254,12 @@ var Bob = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.GameObjects.Blitter.Bob#destroy
|
||||
* @since 3.0.0
|
||||
*/
|
||||
destroy: function ()
|
||||
{
|
||||
this.parent.dirty = true;
|
||||
|
@ -94,6 +271,13 @@ var Bob = new Class({
|
|||
this.data = undefined;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @name Phaser.GameObjects.Blitter.Bob#visible
|
||||
* @type {boolean}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
visible: {
|
||||
|
||||
get: function ()
|
||||
|
@ -109,6 +293,13 @@ var Bob = new Class({
|
|||
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @name Phaser.GameObjects.Blitter.Bob#alpha
|
||||
* @type {number}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
alpha: {
|
||||
|
||||
get: function ()
|
||||
|
|
|
@ -4,26 +4,26 @@ var GetPoint = require('./GetPoint');
|
|||
var GetPoints = require('./GetPoints');
|
||||
var Random = require('./Random');
|
||||
|
||||
/**
|
||||
* A Circle object.
|
||||
*
|
||||
* This is a geometry object, containing numerical values and related methods to inspect and modify them.
|
||||
* It is not a Game Object, in that you cannot add it to the display list, and it has no texture.
|
||||
* To render a Circle you should look at the capabilities of the Graphics class.
|
||||
*
|
||||
* @class Circle
|
||||
* @memberOf Phaser.Geom
|
||||
* @constructor
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {number} [x=0] - The x position of the center of the circle.
|
||||
* @param {number} [y=0] - The y position of the center of the circle.
|
||||
* @param {number} [radius=0] - The radius of the circle.
|
||||
*/
|
||||
var Circle = new Class({
|
||||
|
||||
initialize:
|
||||
|
||||
/**
|
||||
* A Circle object.
|
||||
*
|
||||
* This is a geometry object, containing numerical values and related methods to inspect and modify them.
|
||||
* It is not a Game Object, in that you cannot add it to the display list, and it has no texture.
|
||||
* To render a Circle you should look at the capabilities of the Graphics class.
|
||||
*
|
||||
* @class Circle
|
||||
* @memberOf Phaser.Geom
|
||||
* @constructor
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {number} [x=0] - The x position of the center of the circle.
|
||||
* @param {number} [y=0] - The y position of the center of the circle.
|
||||
* @param {number} [radius=0] - The radius of the circle.
|
||||
*/
|
||||
function Circle (x, y, radius)
|
||||
{
|
||||
if (x === undefined) { x = 0; }
|
||||
|
|
Loading…
Reference in a new issue