Fixed jsdocs

This commit is contained in:
Richard Davey 2018-02-12 21:39:26 +00:00
parent 08a968f5ec
commit ae3cd50356
7 changed files with 219 additions and 64 deletions

View file

@ -834,6 +834,7 @@ var Camera = new Class({
* @since 3.0.0
*
* @param {number} baseScale - [description]
* @param {number} resolution - [description]
*
*/
preRender: function (baseScale, resolution)

View file

@ -5,7 +5,7 @@
*/
/**
* @module Phaser.Display.Canvas.CanvasInterpolation
* @namespace Phaser.Display.Canvas.CanvasInterpolation
* @since 3.0.0
*/
var CanvasInterpolation = {
@ -13,7 +13,7 @@ var CanvasInterpolation = {
/**
* Sets the CSS image-rendering property on the given canvas to be 'crisp' (aka 'optimize contrast' on webkit).
*
* @function setCrisp
* @function Phaser.Display.Canvas.CanvasInterpolation.setCrisp
* @since 3.0.0
*
* @param {HTMLCanvasElement} canvas - The canvas object to have the style set on.
@ -37,7 +37,7 @@ var CanvasInterpolation = {
/**
* Sets the CSS image-rendering property on the given canvas to be 'bicubic' (aka 'auto').
*
* @function setBicubic
* @function Phaser.Display.Canvas.CanvasInterpolation.setBicubic
* @since 3.0.0
*
* @param {HTMLCanvasElement} canvas - The canvas object to have the style set on.

View file

@ -13,15 +13,32 @@ var pool = [];
// Automatically apply smoothing(false) to created Canvas elements
var _disableContextSmoothing = false;
// This singleton is instantiated as soon as Phaser loads,
// before a Phaser.Game instance has even been created.
// Which means all instances of Phaser Games on the same page
// can share the one single pool
// The CanvasPool is a global static object, that allows Phaser to recycle and pool Canvas DOM elements.
/**
* The CanvasPool is a global static object, that allows Phaser to recycle and pool Canvas DOM elements.
*
* This singleton is instantiated as soon as Phaser loads,
* before a Phaser.Game instance has even been created.
* Which means all instances of Phaser Games on the same page
* can share the one single pool
*
* @namespace Phaser.Display.Canvas.CanvasPool
* @since 3.0.0
*/
var CanvasPool = function ()
{
// Creates a new Canvas DOM element, or pulls one from the pool if free.
/**
* Creates a new Canvas DOM element, or pulls one from the pool if free.
*
* @function Phaser.Display.Canvas.CanvasPool.create
* @since 3.0.0
*
* @param {any} parent - [description]
* @param {integer} [width=1] - [description]
* @param {integer} [height=1] - [description]
* @param {integer} [type] - [description]
*
* @return {HTMLCanvasElement} [description]
*/
var create = function (parent, width, height, type)
{
if (width === undefined) { width = 1; }
@ -61,17 +78,50 @@ var CanvasPool = function ()
return canvas;
};
/**
* Creates a new Canvas DOM element, or pulls one from the pool if free.
*
* @function Phaser.Display.Canvas.CanvasPool.create2D
* @since 3.0.0
*
* @param {any} parent - [description]
* @param {integer} [width=1] - [description]
* @param {integer} [height=1] - [description]
*
* @return {HTMLCanvasElement} [description]
*/
var create2D = function (parent, width, height)
{
return create(parent, width, height, CONST.CANVAS);
};
/**
* Creates a new Canvas DOM element, or pulls one from the pool if free.
*
* @function Phaser.Display.Canvas.CanvasPool.createWebGL
* @since 3.0.0
*
* @param {any} parent - [description]
* @param {integer} [width=1] - [description]
* @param {integer} [height=1] - [description]
*
* @return {HTMLCanvasElement} [description]
*/
var createWebGL = function (parent, width, height)
{
return create(parent, width, height, CONST.WEBGL);
};
// Gets the first free canvas index from the pool.
/**
* Gets the first free canvas index from the pool.
*
* @function Phaser.Display.Canvas.CanvasPool.first
* @since 3.0.0
*
* @param {integer} [type] - [description]
*
* @return {HTMLCanvasElement} [description]
*/
var first = function (type)
{
if (type === undefined) { type = CONST.CANVAS; }
@ -87,8 +137,15 @@ var CanvasPool = function ()
return null;
};
// Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use.
// The canvas has its width and height set to 1, and its parent attribute nulled.
/**
* Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use.
* The canvas has its width and height set to 1, and its parent attribute nulled.
*
* @function Phaser.Display.Canvas.CanvasPool.remove
* @since 3.0.0
*
* @param {any} parent - [description]
*/
var remove = function (parent)
{
// Check to see if the parent is a canvas object
@ -106,7 +163,14 @@ var CanvasPool = function ()
});
};
// Gets the total number of used canvas elements in the pool.
/**
* Gets the total number of used canvas elements in the pool.
*
* @function Phaser.Display.Canvas.CanvasPool.total
* @since 3.0.0
*
* @return {integer} [description]
*/
var total = function ()
{
var c = 0;
@ -122,19 +186,36 @@ var CanvasPool = function ()
return c;
};
// Gets the total number of free canvas elements in the pool.
/**
* Gets the total number of free canvas elements in the pool.
*
* @function Phaser.Display.Canvas.CanvasPool.free
* @since 3.0.0
*
* @return {integer} [description]
*/
var free = function ()
{
return pool.length - total();
};
// Disable context smoothing on any new Canvas element created
/**
* Disable context smoothing on any new Canvas element created.
*
* @function Phaser.Display.Canvas.CanvasPool.disableSmoothing
* @since 3.0.0
*/
var disableSmoothing = function ()
{
_disableContextSmoothing = true;
};
// Enable context smoothing on any new Canvas element created
/**
* Enable context smoothing on any new Canvas element created.
*
* @function Phaser.Display.Canvas.CanvasPool.enableSmoothing
* @since 3.0.0
*/
var enableSmoothing = function ()
{
_disableContextSmoothing = false;

View file

@ -4,13 +4,25 @@
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
// Browser specific prefix, so not going to change between contexts, only between browsers
var prefix = '';
/**
* @namespace Phaser.Display.Canvas.Smoothing
* @since 3.0.0
*/
var Smoothing = function ()
{
// Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set.
/**
* Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set.
*
* @function Phaser.Display.Canvas.Smoothing.getPrefix
* @since 3.0.0
*
* @param {[type]} context - [description]
*
* @return {string} [description]
*/
var getPrefix = function (context)
{
var vendors = [ 'i', 'webkitI', 'msI', 'mozI', 'oI' ];
@ -29,12 +41,19 @@ var Smoothing = function ()
};
/**
* Sets the Image Smoothing property on the given context. Set to false to disable image smoothing.
* By default browsers have image smoothing enabled, which isn't always what you visually want, especially
* when using pixel art in a game. Note that this sets the property on the context itself, so that any image
* drawn to the context will be affected. This sets the property across all current browsers but support is
* patchy on earlier browsers, especially on mobile.
*/
* Sets the Image Smoothing property on the given context. Set to false to disable image smoothing.
* By default browsers have image smoothing enabled, which isn't always what you visually want, especially
* when using pixel art in a game. Note that this sets the property on the context itself, so that any image
* drawn to the context will be affected. This sets the property across all current browsers but support is
* patchy on earlier browsers, especially on mobile.
*
* @function Phaser.Display.Canvas.Smoothing.enable
* @since 3.0.0
*
* @param {[type]} context - [description]
*
* @return {[type]} [description]
*/
var enable = function (context)
{
if (prefix === '')
@ -51,12 +70,19 @@ var Smoothing = function ()
};
/**
* Sets the Image Smoothing property on the given context. Set to false to disable image smoothing.
* By default browsers have image smoothing enabled, which isn't always what you visually want, especially
* when using pixel art in a game. Note that this sets the property on the context itself, so that any image
* drawn to the context will be affected. This sets the property across all current browsers but support is
* patchy on earlier browsers, especially on mobile.
*/
* Sets the Image Smoothing property on the given context. Set to false to disable image smoothing.
* By default browsers have image smoothing enabled, which isn't always what you visually want, especially
* when using pixel art in a game. Note that this sets the property on the context itself, so that any image
* drawn to the context will be affected. This sets the property across all current browsers but support is
* patchy on earlier browsers, especially on mobile.
*
* @function Phaser.Display.Canvas.Smoothing.disable
* @since 3.0.0
*
* @param {[type]} context - [description]
*
* @return {[type]} [description]
*/
var disable = function (context)
{
if (prefix === '')
@ -75,6 +101,13 @@ var Smoothing = function ()
/**
* Returns `true` if the given context has image smoothing enabled, otherwise returns `false`.
* Returns null if no smoothing prefix is available.
*
* @function Phaser.Display.Canvas.Smoothing.isEnabled
* @since 3.0.0
*
* @param {[type]} context - [description]
*
* @return {boolean} [description]
*/
var isEnabled = function (context)
{
@ -87,6 +120,7 @@ var Smoothing = function ()
getPrefix: getPrefix,
isEnabled: isEnabled
};
};
module.exports = Smoothing();

View file

@ -36,7 +36,8 @@ var Color = new Class({
/**
* The internal red color value.
*
* @property {number} r
* @name Phaser.Display.Color#r
* @type {number}
* @private
* @default 0
* @since 3.0.0
@ -46,7 +47,8 @@ var Color = new Class({
/**
* The internal green color value.
*
* @property {number} g
* @name Phaser.Display.Color#g
* @type {number}
* @private
* @default 0
* @since 3.0.0
@ -56,7 +58,8 @@ var Color = new Class({
/**
* The internal blue color value.
*
* @property {number} b
* @name Phaser.Display.Color#b
* @type {number}
* @private
* @default 0
* @since 3.0.0
@ -66,7 +69,8 @@ var Color = new Class({
/**
* The internal alpha color value.
*
* @property {number} a
* @name Phaser.Display.Color#a
* @type {number}
* @private
* @default 255
* @since 3.0.0
@ -76,7 +80,8 @@ var Color = new Class({
/**
* An array containing the calculated color values for WebGL use.
*
* @property {array} gl
* @name Phaser.Display.Color#gl
* @type {array}
* @since 3.0.0
*/
this.gl = [ 0, 0, 0, 1 ];
@ -84,7 +89,8 @@ var Color = new Class({
/**
* Pre-calculated internal color value.
*
* @property {number} _color
* @name Phaser.Display.Color#_color
* @type {number}
* @private
* @default 0
* @since 3.0.0
@ -94,7 +100,8 @@ var Color = new Class({
/**
* Pre-calculated internal color32 value.
*
* @property {number} _color32
* @name Phaser.Display.Color#_color32
* @type {number}
* @private
* @default 0
* @since 3.0.0
@ -104,7 +111,8 @@ var Color = new Class({
/**
* Pre-calculated internal color rgb string value.
*
* @property {string} _rgba
* @name Phaser.Display.Color#_rgba
* @type {string}
* @private
* @default ''
* @since 3.0.0
@ -240,7 +248,7 @@ var Color = new Class({
* The color of this Color component, not including the alpha channel.
*
* @name Phaser.Display.Color#color
* @property {number} color
* @type {number}
* @readOnly
* @since 3.0.0
*/
@ -257,7 +265,7 @@ var Color = new Class({
* The color of this Color component, including the alpha channel.
*
* @name Phaser.Display.Color#color32
* @property {number} color32
* @type {number}
* @readOnly
* @since 3.0.0
*/
@ -274,7 +282,7 @@ var Color = new Class({
* The color of this Color component as a string which can be used in CSS color values.
*
* @name Phaser.Display.Color#rgba
* @property {string} rgba
* @type {string}
* @readOnly
* @since 3.0.0
*/
@ -291,7 +299,7 @@ var Color = new Class({
* The red color value, normalized to the range 0 to 1.
*
* @name Phaser.Display.Color#redGL
* @property {float} redGL
* @type {float}
* @since 3.0.0
*/
redGL: {
@ -316,7 +324,7 @@ var Color = new Class({
* The green color value, normalized to the range 0 to 1.
*
* @name Phaser.Display.Color#greenGL
* @property {float} greenGL
* @type {float}
* @since 3.0.0
*/
greenGL: {
@ -341,7 +349,7 @@ var Color = new Class({
* The blue color value, normalized to the range 0 to 1.
*
* @name Phaser.Display.Color#blueGL
* @property {float} blueGL
* @type {float}
* @since 3.0.0
*/
blueGL: {
@ -366,7 +374,7 @@ var Color = new Class({
* The alpha color value, normalized to the range 0 to 1.
*
* @name Phaser.Display.Color#alphaGL
* @property {float} alphaGL
* @type {float}
* @since 3.0.0
*/
alphaGL: {
@ -391,7 +399,7 @@ var Color = new Class({
* The red color value, normalized to the range 0 to 255.
*
* @name Phaser.Display.Color#red
* @property {float} red
* @type {float}
* @since 3.0.0
*/
red: {
@ -418,7 +426,7 @@ var Color = new Class({
* The green color value, normalized to the range 0 to 255.
*
* @name Phaser.Display.Color#green
* @property {float} green
* @type {float}
* @since 3.0.0
*/
green: {
@ -445,7 +453,7 @@ var Color = new Class({
* The blue color value, normalized to the range 0 to 255.
*
* @name Phaser.Display.Color#blue
* @property {float} blue
* @type {float}
* @since 3.0.0
*/
blue: {
@ -472,7 +480,7 @@ var Color = new Class({
* The alpha color value, normalized to the range 0 to 255.
*
* @name Phaser.Display.Color#alpha
* @property {float} alpha
* @type {float}
* @since 3.0.0
*/
alpha: {

View file

@ -29,7 +29,8 @@ var BitmapMask = new Class({
/**
* [description]
*
* @property {[type]} bitmapMask
* @name Phaser.Display.Masks.BitmapMask#bitmapMask
* @type {[type]}
* @since 3.0.0
*/
this.bitmapMask = renderable;
@ -37,7 +38,8 @@ var BitmapMask = new Class({
/**
* [description]
*
* @property {?[type]} maskRenderTarget
* @name Phaser.Display.Masks.BitmapMask#maskRenderTarget
* @type {[type]}
* @default null
* @since 3.0.0
*/
@ -46,7 +48,8 @@ var BitmapMask = new Class({
/**
* [description]
*
* @property {?[type]} mainRenderTarget
* @name Phaser.Display.Masks.BitmapMask#mainRenderTarget
* @type {[type]}
* @default null
* @since 3.0.0
*/
@ -55,7 +58,8 @@ var BitmapMask = new Class({
/**
* [description]
*
* @property {?[type]} maskTexture
* @name Phaser.Display.Masks.BitmapMask#maskTexture
* @type {[type]}
* @default null
* @since 3.0.0
*/
@ -64,7 +68,8 @@ var BitmapMask = new Class({
/**
* [description]
*
* @property {?[type]} mainTexture
* @name Phaser.Display.Masks.BitmapMask#mainTexture
* @type {[type]}
* @default null
* @since 3.0.0
*/
@ -73,12 +78,31 @@ var BitmapMask = new Class({
/**
* [description]
*
* @property {boolean} dirty
* @name Phaser.Display.Masks.BitmapMask#dirty
* @type {boolean}
* @default true
* @since 3.0.0
*/
this.dirty = true;
/**
* [description]
*
* @name Phaser.Display.Masks.BitmapMask#mainFramebuffer
* @type {[type]}
* @since 3.0.0
*/
this.mainFramebuffer = null;
/**
* [description]
*
* @name Phaser.Display.Masks.BitmapMask#maskFramebuffer
* @type {[type]}
* @since 3.0.0
*/
this.maskFramebuffer = null;
if (renderer.gl)
{
var width = renderer.width;
@ -132,7 +156,7 @@ var BitmapMask = new Class({
*
* @param {[type]} renderer - [description]
* @param {[type]} maskedObject - [description]
* @param {[type]} camera - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to.
*/
preRenderWebGL: function (renderer, maskedObject, camera)
{
@ -160,7 +184,7 @@ var BitmapMask = new Class({
*
* @param {[type]} renderer - [description]
* @param {[type]} mask - [description]
* @param {[type]} camera - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to.
*/
preRenderCanvas: function (renderer, mask, camera)
{

View file

@ -24,6 +24,13 @@ var GeometryMask = new Class({
function GeometryMask (scene, graphicsGeometry)
{
/**
* [description]
*
* @name Phaser.Display.Masks.GeometryMask#geometryMask
* @type {Phaser.GameObjects.Graphics}
* @since 3.0.0
*/
this.geometryMask = graphicsGeometry;
},
@ -33,7 +40,7 @@ var GeometryMask = new Class({
* @method Phaser.Display.Masks.GeometryMask#setShape
* @since 3.0.0
*
* @param {[type]} graphicsGeometry - [description]
* @param {Phaser.GameObjects.Graphics} graphicsGeometry - [description]
*/
setShape: function (graphicsGeometry)
{
@ -48,7 +55,7 @@ var GeometryMask = new Class({
*
* @param {[type]} renderer - [description]
* @param {[type]} mask - [description]
* @param {[type]} camera - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
preRenderWebGL: function (renderer, mask, camera)
{
@ -100,14 +107,16 @@ var GeometryMask = new Class({
*
* @param {[type]} renderer - [description]
* @param {[type]} mask - [description]
* @param {[type]} camera - [description]
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
*/
preRenderCanvas: function (renderer, mask, camera)
{
var geometryMask = this.geometryMask;
renderer.currentContext.save();
//renderer.currentContext.beginPath();
geometryMask.renderCanvas(renderer, geometryMask, 0.0, camera, null, true);
renderer.currentContext.clip();
},
@ -121,11 +130,9 @@ var GeometryMask = new Class({
*/
postRenderCanvas: function (renderer)
{
//renderer.currentContext.closePath();
renderer.currentContext.restore();
}
});
module.exports = GeometryMask;