Added jsdocs

This commit is contained in:
Richard Davey 2018-02-01 00:25:33 +00:00
parent 218dde8d8a
commit c254cb2991
4 changed files with 157 additions and 3 deletions

View file

@ -1,4 +1,3 @@
/**
* Provides methods used for getting and setting the origin of a Game Object.
* Values are normalized, given in the range 0 to 1.

View file

@ -1,10 +1,48 @@
// Pipeline is a WebGL-Only feature
/**
* Provides methods used for setting the WebGL rendering pipeline of a Game Object.
*
* @name Phaser.GameObjects.Components.Pipeline
* @mixin
* @webglOnly
* @since 3.0.0
*/
var Pipeline = {
/**
* [description]
*
* @name Phaser.GameObjects.Components.Pipeline#defaultPipeline
* @type {Phaser.Renderer.WebGL.WebGLPipeline}
* @default null
* @webglOnly
* @since 3.0.0
*/
defaultPipeline: null,
/**
* [description]
*
* @name Phaser.GameObjects.Components.Pipeline#pipeline
* @type {Phaser.Renderer.WebGL.WebGLPipeline}
* @default null
* @webglOnly
* @since 3.0.0
*/
pipeline: null,
/**
* Sets the initial WebGL Pipeline of this Game Object.
* This should only be called during the instantiation of the Game Object.
*
* @method Phaser.GameObjects.Components.Pipeline.initPipeline
* @webglOnly
* @since 3.0.0
*
* @param {string} pipelineName - The name of the pipeline to set on this Game Object.
*
* @return {boolean} `true` if the pipeline was set successfully, otherwise `false`.
*/
initPipeline: function (pipelineName)
{
var renderer = this.scene.sys.game.renderer;
@ -19,6 +57,17 @@ var Pipeline = {
return false;
},
/**
* Sets the active WebGL Pipeline of this Game Object.
*
* @method Phaser.GameObjects.Components.Pipeline.setPipeline
* @webglOnly
* @since 3.0.0
*
* @param {string} pipelineName - The name of the pipeline to set on this Game Object.
*
* @return {boolean} `true` if the pipeline was set successfully, otherwise `false`.
*/
setPipeline: function (pipelineName)
{
var renderer = this.scene.sys.game.renderer;
@ -32,12 +81,30 @@ var Pipeline = {
return false;
},
/**
* Resets the WebGL Pipeline of this Game Object back to the default it was created with.
*
* @method Phaser.GameObjects.Components.Pipeline.resetPipeline
* @webglOnly
* @since 3.0.0
*
* @return {boolean} `true` if the pipeline was set successfully, otherwise `false`.
*/
resetPipeline: function ()
{
this.pipeline = this.defaultPipeline;
return (this.pipeline !== null);
},
/**
* Gets the name of the WebGL Pipeline this Game Object is currently using.
*
* @method Phaser.GameObjects.Components.Pipeline.getPipelineName
* @webglOnly
* @since 3.0.0
*
* @return {string} The string-based name of the pipeline being used by this Game Object.
*/
getPipelineName: function ()
{
return this.pipeline.name;

View file

@ -1,11 +1,25 @@
var ScaleModes = require('../../renderer/ScaleModes');
// ScaleMode Component
/**
* Provides methods used for getting and setting the scale of a Game Object.
*
* @name Phaser.GameObjects.Components.ScaleMode
* @mixin
* @since 3.0.0
*/
var ScaleMode = {
_scaleMode: ScaleModes.DEFAULT,
/**
* The Scale Mode being used by this Game Object.
* Can be either `ScaleModes.LINEAR` or `ScaleModes.NEAREST`.
*
* @name Phaser.GameObjects.Components.ScaleMode#scaleMode
* @type {integer}
* @since 3.0.0
*/
scaleMode: {
get: function ()
@ -23,6 +37,17 @@ var ScaleMode = {
},
/**
* Sets the Scale Mode being used by this Game Object.
* Can be either `ScaleModes.LINEAR` or `ScaleModes.NEAREST`.
*
* @method Phaser.GameObjects.Components.ScaleMode.setScaleMode
* @since 3.0.0
*
* @param {integer} value - The Scale Mode to be used by this Game Object.
*
* @return {Phaser.GameObjects.GameObject} This Game Object instance.
*/
setScaleMode: function (value)
{
this.scaleMode = value;

View file

@ -1,8 +1,71 @@
/**
* Provides methods used for getting and setting the Scroll Factor of a Game Object.
*
* @name Phaser.GameObjects.Components.ScrollFactor
* @mixin
* @since 3.0.0
*/
var ScrollFactor = {
/**
* The horizontal scroll factor of this Game Object.
*
* The scroll factor controls the influence of the movement of a Camera upon this Game Object.
*
* When a camera scrolls it will change the location at which this Game Object is rendered on-screen.
* It does not change the Game Objects actual position values.
*
* A value of 1 means it will move exactly in sync with a camera.
* A value of 0 means it will not move at all, even if the camera moves.
* Other values control the degree to which the camera movement is mapped to this Game Object.
*
* @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorX
* @type {number}
* @default 1
* @since 3.0.0
*/
scrollFactorX: 1,
/**
* The vertical scroll factor of this Game Object.
*
* The scroll factor controls the influence of the movement of a Camera upon this Game Object.
*
* When a camera scrolls it will change the location at which this Game Object is rendered on-screen.
* It does not change the Game Objects actual position values.
*
* A value of 1 means it will move exactly in sync with a camera.
* A value of 0 means it will not move at all, even if the camera moves.
* Other values control the degree to which the camera movement is mapped to this Game Object.
*
* @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorY
* @type {number}
* @default 1
* @since 3.0.0
*/
scrollFactorY: 1,
/**
* Sets the scroll factor of this Game Object.
*
* The scroll factor controls the influence of the movement of a Camera upon this Game Object.
*
* When a camera scrolls it will change the location at which this Game Object is rendered on-screen.
* It does not change the Game Objects actual position values.
*
* A value of 1 means it will move exactly in sync with a camera.
* A value of 0 means it will not move at all, even if the camera moves.
* Other values control the degree to which the camera movement is mapped to this Game Object.
*
* @method Phaser.GameObjects.Components.ScrollFactor.setScrollFactor
* @since 3.0.0
*
* @param {number} x - The horizontal scroll factor of this Game Object.
* @param {number} [y] - The vertical scroll factor of this Game Object. If not set it will use the `x` value.
*
* @return {Phaser.GameObjects.GameObject} This Game Object instance.
*/
setScrollFactor: function (x, y)
{
if (y === undefined) { y = x; }