diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 266221f..ef16ae1 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -152,7 +152,7 @@ if (index1 < 0 || index2 < 0) { - throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.'); + throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.'); } this.children[index1] = child2; @@ -199,14 +199,14 @@ /** * Returns the child at the specified index * - * @param index {Number} The index to get the child from + * @param index {Number} The index to get the child at * @return {DisplayObject} The child at the given index, if any. */ Container.prototype.getChildAt = function (index) { if (index < 0 || index >= this.children.length) { - throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); + throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller'); } return this.children[index]; @@ -280,13 +280,13 @@ }; /** - * Useful function that returns a texture of the displayObject object that can then be used to create sprites + * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} See {@link SCALE_MODES} for possible values - * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. - * @return {Texture} a texture of the graphics object + * @return {Texture} a texture of the display object */ Container.prototype.generateTexture = function (renderer, resolution, scaleMode) { @@ -488,9 +488,9 @@ } }; -Container.prototype._renderWebGL = function (/* renderer */) +Container.prototype._renderWebGL = function (renderer) { - // this is where content itself gets renderd.. + // this is where content itself gets rendered... }; diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 266221f..ef16ae1 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -152,7 +152,7 @@ if (index1 < 0 || index2 < 0) { - throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.'); + throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.'); } this.children[index1] = child2; @@ -199,14 +199,14 @@ /** * Returns the child at the specified index * - * @param index {Number} The index to get the child from + * @param index {Number} The index to get the child at * @return {DisplayObject} The child at the given index, if any. */ Container.prototype.getChildAt = function (index) { if (index < 0 || index >= this.children.length) { - throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); + throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller'); } return this.children[index]; @@ -280,13 +280,13 @@ }; /** - * Useful function that returns a texture of the displayObject object that can then be used to create sprites + * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} See {@link SCALE_MODES} for possible values - * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. - * @return {Texture} a texture of the graphics object + * @return {Texture} a texture of the display object */ Container.prototype.generateTexture = function (renderer, resolution, scaleMode) { @@ -488,9 +488,9 @@ } }; -Container.prototype._renderWebGL = function (/* renderer */) +Container.prototype._renderWebGL = function (renderer) { - // this is where content itself gets renderd.. + // this is where content itself gets rendered... }; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 243a75b..9b45b73 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -280,7 +280,7 @@ // temporary matrix variables var a, b, c, d, tx, ty; - // so if rotation is between 0 then we can simplify the multiplication process.. + // so if rotation is between 0 then we can simplify the multiplication process... if (this.rotation % math.PI_2) { // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes @@ -344,13 +344,12 @@ /** * * - * * Retrieves the bounds of the displayObject as a rectangle object * * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (/* matrix */) +DisplayObject.prototype.getBounds = function (matrix) { return math.Rectangle.EMPTY; }; @@ -373,7 +372,7 @@ */ DisplayObject.prototype.toGlobal = function (position) { - // don't need to u[date the lot + // don't need to update the lot this.displayObjectUpdateTransform(); return this.worldTransform.apply(position); }; @@ -403,7 +402,7 @@ * @param renderer {WebGLRenderer} The renderer * @private */ -DisplayObject.prototype.renderWebGL = function (/* renderer */) +DisplayObject.prototype.renderWebGL = function (renderer) { // OVERWRITE; }; @@ -414,11 +413,19 @@ * @param renderer {CanvasRenderer} The renderer * @private */ -DisplayObject.prototype.renderCanvas = function (/* renderer */) +DisplayObject.prototype.renderCanvas = function (renderer) { // OVERWRITE; }; - +/** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. + * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. + * @param resolution {Number} The resolution of the texture being generated + * @param scaleMode {Number} See {@link SCALE_MODES} for possible values + * @return {Texture} a texture of the display object + */ DisplayObject.prototype.generateTexture = function (renderer, resolution, scaleMode) { var bounds = this.getLocalBounds(); diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 266221f..ef16ae1 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -152,7 +152,7 @@ if (index1 < 0 || index2 < 0) { - throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.'); + throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.'); } this.children[index1] = child2; @@ -199,14 +199,14 @@ /** * Returns the child at the specified index * - * @param index {Number} The index to get the child from + * @param index {Number} The index to get the child at * @return {DisplayObject} The child at the given index, if any. */ Container.prototype.getChildAt = function (index) { if (index < 0 || index >= this.children.length) { - throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); + throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller'); } return this.children[index]; @@ -280,13 +280,13 @@ }; /** - * Useful function that returns a texture of the displayObject object that can then be used to create sprites + * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} See {@link SCALE_MODES} for possible values - * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. - * @return {Texture} a texture of the graphics object + * @return {Texture} a texture of the display object */ Container.prototype.generateTexture = function (renderer, resolution, scaleMode) { @@ -488,9 +488,9 @@ } }; -Container.prototype._renderWebGL = function (/* renderer */) +Container.prototype._renderWebGL = function (renderer) { - // this is where content itself gets renderd.. + // this is where content itself gets rendered... }; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 243a75b..9b45b73 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -280,7 +280,7 @@ // temporary matrix variables var a, b, c, d, tx, ty; - // so if rotation is between 0 then we can simplify the multiplication process.. + // so if rotation is between 0 then we can simplify the multiplication process... if (this.rotation % math.PI_2) { // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes @@ -344,13 +344,12 @@ /** * * - * * Retrieves the bounds of the displayObject as a rectangle object * * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (/* matrix */) +DisplayObject.prototype.getBounds = function (matrix) { return math.Rectangle.EMPTY; }; @@ -373,7 +372,7 @@ */ DisplayObject.prototype.toGlobal = function (position) { - // don't need to u[date the lot + // don't need to update the lot this.displayObjectUpdateTransform(); return this.worldTransform.apply(position); }; @@ -403,7 +402,7 @@ * @param renderer {WebGLRenderer} The renderer * @private */ -DisplayObject.prototype.renderWebGL = function (/* renderer */) +DisplayObject.prototype.renderWebGL = function (renderer) { // OVERWRITE; }; @@ -414,11 +413,19 @@ * @param renderer {CanvasRenderer} The renderer * @private */ -DisplayObject.prototype.renderCanvas = function (/* renderer */) +DisplayObject.prototype.renderCanvas = function (renderer) { // OVERWRITE; }; - +/** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. + * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. + * @param resolution {Number} The resolution of the texture being generated + * @param scaleMode {Number} See {@link SCALE_MODES} for possible values + * @return {Texture} a texture of the display object + */ DisplayObject.prototype.generateTexture = function (renderer, resolution, scaleMode) { var bounds = this.getLocalBounds(); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index fea2126..bb1c13e 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -3,14 +3,13 @@ Texture = require('../textures/Texture'), CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'), CanvasGraphics = require('../renderers/canvas/utils/CanvasGraphics'), - // WebGLGraphics = require('../renderers/webgl/utils/WebGLGraphics'), GraphicsData = require('./GraphicsData'), math = require('../math'), CONST = require('../const'); /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and color and fill them. + * rectangles to the display, and to color and fill them. * * @class * @extends Container @@ -160,7 +159,7 @@ * * @return {Graphics} */ -GraphicsData.prototype.clone = function () +Graphics.prototype.clone = function () { var clone = new Graphics(); @@ -1069,7 +1068,7 @@ /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * - * @param {Circle|Rectangle|Ellipse|Line|Polygon} shape The Shape object to draw. + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. * @return {GraphicsData} The generated GraphicsData object. */ Graphics.prototype.drawShape = function (shape) diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 266221f..ef16ae1 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -152,7 +152,7 @@ if (index1 < 0 || index2 < 0) { - throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.'); + throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.'); } this.children[index1] = child2; @@ -199,14 +199,14 @@ /** * Returns the child at the specified index * - * @param index {Number} The index to get the child from + * @param index {Number} The index to get the child at * @return {DisplayObject} The child at the given index, if any. */ Container.prototype.getChildAt = function (index) { if (index < 0 || index >= this.children.length) { - throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); + throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller'); } return this.children[index]; @@ -280,13 +280,13 @@ }; /** - * Useful function that returns a texture of the displayObject object that can then be used to create sprites + * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} See {@link SCALE_MODES} for possible values - * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. - * @return {Texture} a texture of the graphics object + * @return {Texture} a texture of the display object */ Container.prototype.generateTexture = function (renderer, resolution, scaleMode) { @@ -488,9 +488,9 @@ } }; -Container.prototype._renderWebGL = function (/* renderer */) +Container.prototype._renderWebGL = function (renderer) { - // this is where content itself gets renderd.. + // this is where content itself gets rendered... }; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 243a75b..9b45b73 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -280,7 +280,7 @@ // temporary matrix variables var a, b, c, d, tx, ty; - // so if rotation is between 0 then we can simplify the multiplication process.. + // so if rotation is between 0 then we can simplify the multiplication process... if (this.rotation % math.PI_2) { // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes @@ -344,13 +344,12 @@ /** * * - * * Retrieves the bounds of the displayObject as a rectangle object * * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (/* matrix */) +DisplayObject.prototype.getBounds = function (matrix) { return math.Rectangle.EMPTY; }; @@ -373,7 +372,7 @@ */ DisplayObject.prototype.toGlobal = function (position) { - // don't need to u[date the lot + // don't need to update the lot this.displayObjectUpdateTransform(); return this.worldTransform.apply(position); }; @@ -403,7 +402,7 @@ * @param renderer {WebGLRenderer} The renderer * @private */ -DisplayObject.prototype.renderWebGL = function (/* renderer */) +DisplayObject.prototype.renderWebGL = function (renderer) { // OVERWRITE; }; @@ -414,11 +413,19 @@ * @param renderer {CanvasRenderer} The renderer * @private */ -DisplayObject.prototype.renderCanvas = function (/* renderer */) +DisplayObject.prototype.renderCanvas = function (renderer) { // OVERWRITE; }; - +/** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. + * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. + * @param resolution {Number} The resolution of the texture being generated + * @param scaleMode {Number} See {@link SCALE_MODES} for possible values + * @return {Texture} a texture of the display object + */ DisplayObject.prototype.generateTexture = function (renderer, resolution, scaleMode) { var bounds = this.getLocalBounds(); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index fea2126..bb1c13e 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -3,14 +3,13 @@ Texture = require('../textures/Texture'), CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'), CanvasGraphics = require('../renderers/canvas/utils/CanvasGraphics'), - // WebGLGraphics = require('../renderers/webgl/utils/WebGLGraphics'), GraphicsData = require('./GraphicsData'), math = require('../math'), CONST = require('../const'); /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and color and fill them. + * rectangles to the display, and to color and fill them. * * @class * @extends Container @@ -160,7 +159,7 @@ * * @return {Graphics} */ -GraphicsData.prototype.clone = function () +Graphics.prototype.clone = function () { var clone = new Graphics(); @@ -1069,7 +1068,7 @@ /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * - * @param {Circle|Rectangle|Ellipse|Line|Polygon} shape The Shape object to draw. + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. * @return {GraphicsData} The generated GraphicsData object. */ Graphics.prototype.drawShape = function (shape) diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 788f6f2..18e3b5c 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -3,6 +3,13 @@ * * @class * @namespace PIXI + * @param lineWidth {number} the width of the line to draw + * @param lineColor {number} the color of the line to draw + * @param lineAlpha {number} the alpha of the line to draw + * @param fillColor {number} the color of the fill + * @param fillAlpha {number} the alpha of the fill + * @param fill {boolean} whether or not the shape is filled with a colour + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 266221f..ef16ae1 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -152,7 +152,7 @@ if (index1 < 0 || index2 < 0) { - throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.'); + throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.'); } this.children[index1] = child2; @@ -199,14 +199,14 @@ /** * Returns the child at the specified index * - * @param index {Number} The index to get the child from + * @param index {Number} The index to get the child at * @return {DisplayObject} The child at the given index, if any. */ Container.prototype.getChildAt = function (index) { if (index < 0 || index >= this.children.length) { - throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); + throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller'); } return this.children[index]; @@ -280,13 +280,13 @@ }; /** - * Useful function that returns a texture of the displayObject object that can then be used to create sprites + * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} See {@link SCALE_MODES} for possible values - * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. - * @return {Texture} a texture of the graphics object + * @return {Texture} a texture of the display object */ Container.prototype.generateTexture = function (renderer, resolution, scaleMode) { @@ -488,9 +488,9 @@ } }; -Container.prototype._renderWebGL = function (/* renderer */) +Container.prototype._renderWebGL = function (renderer) { - // this is where content itself gets renderd.. + // this is where content itself gets rendered... }; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 243a75b..9b45b73 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -280,7 +280,7 @@ // temporary matrix variables var a, b, c, d, tx, ty; - // so if rotation is between 0 then we can simplify the multiplication process.. + // so if rotation is between 0 then we can simplify the multiplication process... if (this.rotation % math.PI_2) { // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes @@ -344,13 +344,12 @@ /** * * - * * Retrieves the bounds of the displayObject as a rectangle object * * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (/* matrix */) +DisplayObject.prototype.getBounds = function (matrix) { return math.Rectangle.EMPTY; }; @@ -373,7 +372,7 @@ */ DisplayObject.prototype.toGlobal = function (position) { - // don't need to u[date the lot + // don't need to update the lot this.displayObjectUpdateTransform(); return this.worldTransform.apply(position); }; @@ -403,7 +402,7 @@ * @param renderer {WebGLRenderer} The renderer * @private */ -DisplayObject.prototype.renderWebGL = function (/* renderer */) +DisplayObject.prototype.renderWebGL = function (renderer) { // OVERWRITE; }; @@ -414,11 +413,19 @@ * @param renderer {CanvasRenderer} The renderer * @private */ -DisplayObject.prototype.renderCanvas = function (/* renderer */) +DisplayObject.prototype.renderCanvas = function (renderer) { // OVERWRITE; }; - +/** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. + * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. + * @param resolution {Number} The resolution of the texture being generated + * @param scaleMode {Number} See {@link SCALE_MODES} for possible values + * @return {Texture} a texture of the display object + */ DisplayObject.prototype.generateTexture = function (renderer, resolution, scaleMode) { var bounds = this.getLocalBounds(); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index fea2126..bb1c13e 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -3,14 +3,13 @@ Texture = require('../textures/Texture'), CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'), CanvasGraphics = require('../renderers/canvas/utils/CanvasGraphics'), - // WebGLGraphics = require('../renderers/webgl/utils/WebGLGraphics'), GraphicsData = require('./GraphicsData'), math = require('../math'), CONST = require('../const'); /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and color and fill them. + * rectangles to the display, and to color and fill them. * * @class * @extends Container @@ -160,7 +159,7 @@ * * @return {Graphics} */ -GraphicsData.prototype.clone = function () +Graphics.prototype.clone = function () { var clone = new Graphics(); @@ -1069,7 +1068,7 @@ /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * - * @param {Circle|Rectangle|Ellipse|Line|Polygon} shape The Shape object to draw. + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. * @return {GraphicsData} The generated GraphicsData object. */ Graphics.prototype.drawShape = function (shape) diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 788f6f2..18e3b5c 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -3,6 +3,13 @@ * * @class * @namespace PIXI + * @param lineWidth {number} the width of the line to draw + * @param lineColor {number} the color of the line to draw + * @param lineAlpha {number} the alpha of the line to draw + * @param fillColor {number} the color of the fill + * @param fillAlpha {number} the alpha of the fill + * @param fill {boolean} whether or not the shape is filled with a colour + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index f0c5ffd..9dfcaad 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -11,6 +11,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this object renderer works for. */ function GraphicsRenderer(renderer) @@ -120,7 +121,6 @@ * * @private * @param graphicsData {Graphics} The graphics object to update - * @param gl {WebGLContext} the current WebGL drawing context */ GraphicsRenderer.prototype.updateGraphics = function(graphics) { @@ -251,8 +251,8 @@ * * * @private - * @param webGL {WebGLContext} - * @param type {number} + * @param webGL {WebGLRenderingContext} the current WebGL drawing context + * @param type {number} TODO @Alvin */ GraphicsRenderer.prototype.switchMode = function (webGL, type) { @@ -286,7 +286,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRectangle = function (graphicsData, webGLData) { @@ -352,7 +352,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRoundedRectangle = function (graphicsData, webGLData) { @@ -429,7 +429,7 @@ * @param cpY {number} Control point y * @param toX {number} Destination point x * @param toY {number} Destination point y - * @return {number[]} + * @return {number[]} an array of points */ GraphicsRenderer.prototype.quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY) { @@ -473,7 +473,7 @@ * * @private * @param graphicsData {Graphics} The graphics object to draw - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildCircle = function (graphicsData, webGLData) { @@ -554,7 +554,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildLine = function (graphicsData, webGLData) { @@ -769,7 +769,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildComplexPoly = function (graphicsData, webGLData) { @@ -831,7 +831,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildPoly = function (graphicsData, webGLData) { diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 266221f..ef16ae1 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -152,7 +152,7 @@ if (index1 < 0 || index2 < 0) { - throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.'); + throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.'); } this.children[index1] = child2; @@ -199,14 +199,14 @@ /** * Returns the child at the specified index * - * @param index {Number} The index to get the child from + * @param index {Number} The index to get the child at * @return {DisplayObject} The child at the given index, if any. */ Container.prototype.getChildAt = function (index) { if (index < 0 || index >= this.children.length) { - throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); + throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller'); } return this.children[index]; @@ -280,13 +280,13 @@ }; /** - * Useful function that returns a texture of the displayObject object that can then be used to create sprites + * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} See {@link SCALE_MODES} for possible values - * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. - * @return {Texture} a texture of the graphics object + * @return {Texture} a texture of the display object */ Container.prototype.generateTexture = function (renderer, resolution, scaleMode) { @@ -488,9 +488,9 @@ } }; -Container.prototype._renderWebGL = function (/* renderer */) +Container.prototype._renderWebGL = function (renderer) { - // this is where content itself gets renderd.. + // this is where content itself gets rendered... }; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 243a75b..9b45b73 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -280,7 +280,7 @@ // temporary matrix variables var a, b, c, d, tx, ty; - // so if rotation is between 0 then we can simplify the multiplication process.. + // so if rotation is between 0 then we can simplify the multiplication process... if (this.rotation % math.PI_2) { // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes @@ -344,13 +344,12 @@ /** * * - * * Retrieves the bounds of the displayObject as a rectangle object * * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (/* matrix */) +DisplayObject.prototype.getBounds = function (matrix) { return math.Rectangle.EMPTY; }; @@ -373,7 +372,7 @@ */ DisplayObject.prototype.toGlobal = function (position) { - // don't need to u[date the lot + // don't need to update the lot this.displayObjectUpdateTransform(); return this.worldTransform.apply(position); }; @@ -403,7 +402,7 @@ * @param renderer {WebGLRenderer} The renderer * @private */ -DisplayObject.prototype.renderWebGL = function (/* renderer */) +DisplayObject.prototype.renderWebGL = function (renderer) { // OVERWRITE; }; @@ -414,11 +413,19 @@ * @param renderer {CanvasRenderer} The renderer * @private */ -DisplayObject.prototype.renderCanvas = function (/* renderer */) +DisplayObject.prototype.renderCanvas = function (renderer) { // OVERWRITE; }; - +/** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. + * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. + * @param resolution {Number} The resolution of the texture being generated + * @param scaleMode {Number} See {@link SCALE_MODES} for possible values + * @return {Texture} a texture of the display object + */ DisplayObject.prototype.generateTexture = function (renderer, resolution, scaleMode) { var bounds = this.getLocalBounds(); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index fea2126..bb1c13e 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -3,14 +3,13 @@ Texture = require('../textures/Texture'), CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'), CanvasGraphics = require('../renderers/canvas/utils/CanvasGraphics'), - // WebGLGraphics = require('../renderers/webgl/utils/WebGLGraphics'), GraphicsData = require('./GraphicsData'), math = require('../math'), CONST = require('../const'); /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and color and fill them. + * rectangles to the display, and to color and fill them. * * @class * @extends Container @@ -160,7 +159,7 @@ * * @return {Graphics} */ -GraphicsData.prototype.clone = function () +Graphics.prototype.clone = function () { var clone = new Graphics(); @@ -1069,7 +1068,7 @@ /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * - * @param {Circle|Rectangle|Ellipse|Line|Polygon} shape The Shape object to draw. + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. * @return {GraphicsData} The generated GraphicsData object. */ Graphics.prototype.drawShape = function (shape) diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 788f6f2..18e3b5c 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -3,6 +3,13 @@ * * @class * @namespace PIXI + * @param lineWidth {number} the width of the line to draw + * @param lineColor {number} the color of the line to draw + * @param lineAlpha {number} the alpha of the line to draw + * @param fillColor {number} the color of the fill + * @param fillAlpha {number} the alpha of the fill + * @param fill {boolean} whether or not the shape is filled with a colour + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index f0c5ffd..9dfcaad 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -11,6 +11,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this object renderer works for. */ function GraphicsRenderer(renderer) @@ -120,7 +121,6 @@ * * @private * @param graphicsData {Graphics} The graphics object to update - * @param gl {WebGLContext} the current WebGL drawing context */ GraphicsRenderer.prototype.updateGraphics = function(graphics) { @@ -251,8 +251,8 @@ * * * @private - * @param webGL {WebGLContext} - * @param type {number} + * @param webGL {WebGLRenderingContext} the current WebGL drawing context + * @param type {number} TODO @Alvin */ GraphicsRenderer.prototype.switchMode = function (webGL, type) { @@ -286,7 +286,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRectangle = function (graphicsData, webGLData) { @@ -352,7 +352,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRoundedRectangle = function (graphicsData, webGLData) { @@ -429,7 +429,7 @@ * @param cpY {number} Control point y * @param toX {number} Destination point x * @param toY {number} Destination point y - * @return {number[]} + * @return {number[]} an array of points */ GraphicsRenderer.prototype.quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY) { @@ -473,7 +473,7 @@ * * @private * @param graphicsData {Graphics} The graphics object to draw - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildCircle = function (graphicsData, webGLData) { @@ -554,7 +554,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildLine = function (graphicsData, webGLData) { @@ -769,7 +769,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildComplexPoly = function (graphicsData, webGLData) { @@ -831,7 +831,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildPoly = function (graphicsData, webGLData) { diff --git a/src/core/index.js b/src/core/index.js index 83721d5..b2893e6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -65,7 +65,7 @@ * @param [options.preserveDrawingBuffer=false] {boolean} enables drawing buffer preservation, enable this if you * need to call toDataUrl on the webgl context * @param [options.resolution=1] {number} the resolution of the renderer retina would be 2 - * @param [noWebGL=false] {Boolean} prevents selection of WebGL renderer, even if such is present + * @param [noWebGL=false] {boolean} prevents selection of WebGL renderer, even if such is present * * @return {WebGLRenderer|CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer */ diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 266221f..ef16ae1 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -152,7 +152,7 @@ if (index1 < 0 || index2 < 0) { - throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.'); + throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.'); } this.children[index1] = child2; @@ -199,14 +199,14 @@ /** * Returns the child at the specified index * - * @param index {Number} The index to get the child from + * @param index {Number} The index to get the child at * @return {DisplayObject} The child at the given index, if any. */ Container.prototype.getChildAt = function (index) { if (index < 0 || index >= this.children.length) { - throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); + throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller'); } return this.children[index]; @@ -280,13 +280,13 @@ }; /** - * Useful function that returns a texture of the displayObject object that can then be used to create sprites + * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} See {@link SCALE_MODES} for possible values - * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. - * @return {Texture} a texture of the graphics object + * @return {Texture} a texture of the display object */ Container.prototype.generateTexture = function (renderer, resolution, scaleMode) { @@ -488,9 +488,9 @@ } }; -Container.prototype._renderWebGL = function (/* renderer */) +Container.prototype._renderWebGL = function (renderer) { - // this is where content itself gets renderd.. + // this is where content itself gets rendered... }; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 243a75b..9b45b73 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -280,7 +280,7 @@ // temporary matrix variables var a, b, c, d, tx, ty; - // so if rotation is between 0 then we can simplify the multiplication process.. + // so if rotation is between 0 then we can simplify the multiplication process... if (this.rotation % math.PI_2) { // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes @@ -344,13 +344,12 @@ /** * * - * * Retrieves the bounds of the displayObject as a rectangle object * * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (/* matrix */) +DisplayObject.prototype.getBounds = function (matrix) { return math.Rectangle.EMPTY; }; @@ -373,7 +372,7 @@ */ DisplayObject.prototype.toGlobal = function (position) { - // don't need to u[date the lot + // don't need to update the lot this.displayObjectUpdateTransform(); return this.worldTransform.apply(position); }; @@ -403,7 +402,7 @@ * @param renderer {WebGLRenderer} The renderer * @private */ -DisplayObject.prototype.renderWebGL = function (/* renderer */) +DisplayObject.prototype.renderWebGL = function (renderer) { // OVERWRITE; }; @@ -414,11 +413,19 @@ * @param renderer {CanvasRenderer} The renderer * @private */ -DisplayObject.prototype.renderCanvas = function (/* renderer */) +DisplayObject.prototype.renderCanvas = function (renderer) { // OVERWRITE; }; - +/** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. + * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. + * @param resolution {Number} The resolution of the texture being generated + * @param scaleMode {Number} See {@link SCALE_MODES} for possible values + * @return {Texture} a texture of the display object + */ DisplayObject.prototype.generateTexture = function (renderer, resolution, scaleMode) { var bounds = this.getLocalBounds(); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index fea2126..bb1c13e 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -3,14 +3,13 @@ Texture = require('../textures/Texture'), CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'), CanvasGraphics = require('../renderers/canvas/utils/CanvasGraphics'), - // WebGLGraphics = require('../renderers/webgl/utils/WebGLGraphics'), GraphicsData = require('./GraphicsData'), math = require('../math'), CONST = require('../const'); /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and color and fill them. + * rectangles to the display, and to color and fill them. * * @class * @extends Container @@ -160,7 +159,7 @@ * * @return {Graphics} */ -GraphicsData.prototype.clone = function () +Graphics.prototype.clone = function () { var clone = new Graphics(); @@ -1069,7 +1068,7 @@ /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * - * @param {Circle|Rectangle|Ellipse|Line|Polygon} shape The Shape object to draw. + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. * @return {GraphicsData} The generated GraphicsData object. */ Graphics.prototype.drawShape = function (shape) diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 788f6f2..18e3b5c 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -3,6 +3,13 @@ * * @class * @namespace PIXI + * @param lineWidth {number} the width of the line to draw + * @param lineColor {number} the color of the line to draw + * @param lineAlpha {number} the alpha of the line to draw + * @param fillColor {number} the color of the fill + * @param fillAlpha {number} the alpha of the fill + * @param fill {boolean} whether or not the shape is filled with a colour + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index f0c5ffd..9dfcaad 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -11,6 +11,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this object renderer works for. */ function GraphicsRenderer(renderer) @@ -120,7 +121,6 @@ * * @private * @param graphicsData {Graphics} The graphics object to update - * @param gl {WebGLContext} the current WebGL drawing context */ GraphicsRenderer.prototype.updateGraphics = function(graphics) { @@ -251,8 +251,8 @@ * * * @private - * @param webGL {WebGLContext} - * @param type {number} + * @param webGL {WebGLRenderingContext} the current WebGL drawing context + * @param type {number} TODO @Alvin */ GraphicsRenderer.prototype.switchMode = function (webGL, type) { @@ -286,7 +286,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRectangle = function (graphicsData, webGLData) { @@ -352,7 +352,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRoundedRectangle = function (graphicsData, webGLData) { @@ -429,7 +429,7 @@ * @param cpY {number} Control point y * @param toX {number} Destination point x * @param toY {number} Destination point y - * @return {number[]} + * @return {number[]} an array of points */ GraphicsRenderer.prototype.quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY) { @@ -473,7 +473,7 @@ * * @private * @param graphicsData {Graphics} The graphics object to draw - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildCircle = function (graphicsData, webGLData) { @@ -554,7 +554,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildLine = function (graphicsData, webGLData) { @@ -769,7 +769,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildComplexPoly = function (graphicsData, webGLData) { @@ -831,7 +831,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildPoly = function (graphicsData, webGLData) { diff --git a/src/core/index.js b/src/core/index.js index 83721d5..b2893e6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -65,7 +65,7 @@ * @param [options.preserveDrawingBuffer=false] {boolean} enables drawing buffer preservation, enable this if you * need to call toDataUrl on the webgl context * @param [options.resolution=1] {number} the resolution of the renderer retina would be 2 - * @param [noWebGL=false] {Boolean} prevents selection of WebGL renderer, even if such is present + * @param [noWebGL=false] {boolean} prevents selection of WebGL renderer, even if such is present * * @return {WebGLRenderer|CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer */ diff --git a/src/core/math/Matrix.js b/src/core/math/Matrix.js index ba28c1c..e625842 100644 --- a/src/core/math/Matrix.js +++ b/src/core/math/Matrix.js @@ -1,7 +1,7 @@ var Point = require('./Point'); /** - * The Matrix class is now an object, which makes it a lot faster, + * The pixi Matrix class as an object, which makes it a lot faster, * here is a representation of it : * | a | b | tx| * | c | d | ty| @@ -271,7 +271,11 @@ return this; }; - +/** + * Inverts this matrix + * + * @return {Matrix} This matrix. Good for chaining method calls. + */ Matrix.prototype.invert = function() { var a1 = this.a; @@ -309,7 +313,11 @@ return this; }; - +/** + * Creates a new Matrix object with the same values as this one. + * + * @return {Matrix} A copy of this matrix. Good for chaining method calls. + */ Matrix.prototype.clone = function () { var matrix = new Matrix(); @@ -323,6 +331,11 @@ return matrix; }; +/** + * Changes the values of the given matrix to be the same as the ones in this matrix + * + * @return {Matrix} The matrix given in parameter with its values updated. + */ Matrix.prototype.copy = function (matrix) { matrix.a = this.a; @@ -335,6 +348,11 @@ return matrix; }; - +/** + * A default (identity) matrix + */ Matrix.IDENTITY = new Matrix(); +/** + * A temp matrix + */ Matrix.TEMP_MATRIX = new Matrix(); diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 266221f..ef16ae1 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -152,7 +152,7 @@ if (index1 < 0 || index2 < 0) { - throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.'); + throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.'); } this.children[index1] = child2; @@ -199,14 +199,14 @@ /** * Returns the child at the specified index * - * @param index {Number} The index to get the child from + * @param index {Number} The index to get the child at * @return {DisplayObject} The child at the given index, if any. */ Container.prototype.getChildAt = function (index) { if (index < 0 || index >= this.children.length) { - throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); + throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller'); } return this.children[index]; @@ -280,13 +280,13 @@ }; /** - * Useful function that returns a texture of the displayObject object that can then be used to create sprites + * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} See {@link SCALE_MODES} for possible values - * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. - * @return {Texture} a texture of the graphics object + * @return {Texture} a texture of the display object */ Container.prototype.generateTexture = function (renderer, resolution, scaleMode) { @@ -488,9 +488,9 @@ } }; -Container.prototype._renderWebGL = function (/* renderer */) +Container.prototype._renderWebGL = function (renderer) { - // this is where content itself gets renderd.. + // this is where content itself gets rendered... }; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 243a75b..9b45b73 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -280,7 +280,7 @@ // temporary matrix variables var a, b, c, d, tx, ty; - // so if rotation is between 0 then we can simplify the multiplication process.. + // so if rotation is between 0 then we can simplify the multiplication process... if (this.rotation % math.PI_2) { // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes @@ -344,13 +344,12 @@ /** * * - * * Retrieves the bounds of the displayObject as a rectangle object * * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (/* matrix */) +DisplayObject.prototype.getBounds = function (matrix) { return math.Rectangle.EMPTY; }; @@ -373,7 +372,7 @@ */ DisplayObject.prototype.toGlobal = function (position) { - // don't need to u[date the lot + // don't need to update the lot this.displayObjectUpdateTransform(); return this.worldTransform.apply(position); }; @@ -403,7 +402,7 @@ * @param renderer {WebGLRenderer} The renderer * @private */ -DisplayObject.prototype.renderWebGL = function (/* renderer */) +DisplayObject.prototype.renderWebGL = function (renderer) { // OVERWRITE; }; @@ -414,11 +413,19 @@ * @param renderer {CanvasRenderer} The renderer * @private */ -DisplayObject.prototype.renderCanvas = function (/* renderer */) +DisplayObject.prototype.renderCanvas = function (renderer) { // OVERWRITE; }; - +/** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. + * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. + * @param resolution {Number} The resolution of the texture being generated + * @param scaleMode {Number} See {@link SCALE_MODES} for possible values + * @return {Texture} a texture of the display object + */ DisplayObject.prototype.generateTexture = function (renderer, resolution, scaleMode) { var bounds = this.getLocalBounds(); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index fea2126..bb1c13e 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -3,14 +3,13 @@ Texture = require('../textures/Texture'), CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'), CanvasGraphics = require('../renderers/canvas/utils/CanvasGraphics'), - // WebGLGraphics = require('../renderers/webgl/utils/WebGLGraphics'), GraphicsData = require('./GraphicsData'), math = require('../math'), CONST = require('../const'); /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and color and fill them. + * rectangles to the display, and to color and fill them. * * @class * @extends Container @@ -160,7 +159,7 @@ * * @return {Graphics} */ -GraphicsData.prototype.clone = function () +Graphics.prototype.clone = function () { var clone = new Graphics(); @@ -1069,7 +1068,7 @@ /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * - * @param {Circle|Rectangle|Ellipse|Line|Polygon} shape The Shape object to draw. + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. * @return {GraphicsData} The generated GraphicsData object. */ Graphics.prototype.drawShape = function (shape) diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 788f6f2..18e3b5c 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -3,6 +3,13 @@ * * @class * @namespace PIXI + * @param lineWidth {number} the width of the line to draw + * @param lineColor {number} the color of the line to draw + * @param lineAlpha {number} the alpha of the line to draw + * @param fillColor {number} the color of the fill + * @param fillAlpha {number} the alpha of the fill + * @param fill {boolean} whether or not the shape is filled with a colour + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index f0c5ffd..9dfcaad 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -11,6 +11,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this object renderer works for. */ function GraphicsRenderer(renderer) @@ -120,7 +121,6 @@ * * @private * @param graphicsData {Graphics} The graphics object to update - * @param gl {WebGLContext} the current WebGL drawing context */ GraphicsRenderer.prototype.updateGraphics = function(graphics) { @@ -251,8 +251,8 @@ * * * @private - * @param webGL {WebGLContext} - * @param type {number} + * @param webGL {WebGLRenderingContext} the current WebGL drawing context + * @param type {number} TODO @Alvin */ GraphicsRenderer.prototype.switchMode = function (webGL, type) { @@ -286,7 +286,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRectangle = function (graphicsData, webGLData) { @@ -352,7 +352,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRoundedRectangle = function (graphicsData, webGLData) { @@ -429,7 +429,7 @@ * @param cpY {number} Control point y * @param toX {number} Destination point x * @param toY {number} Destination point y - * @return {number[]} + * @return {number[]} an array of points */ GraphicsRenderer.prototype.quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY) { @@ -473,7 +473,7 @@ * * @private * @param graphicsData {Graphics} The graphics object to draw - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildCircle = function (graphicsData, webGLData) { @@ -554,7 +554,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildLine = function (graphicsData, webGLData) { @@ -769,7 +769,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildComplexPoly = function (graphicsData, webGLData) { @@ -831,7 +831,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildPoly = function (graphicsData, webGLData) { diff --git a/src/core/index.js b/src/core/index.js index 83721d5..b2893e6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -65,7 +65,7 @@ * @param [options.preserveDrawingBuffer=false] {boolean} enables drawing buffer preservation, enable this if you * need to call toDataUrl on the webgl context * @param [options.resolution=1] {number} the resolution of the renderer retina would be 2 - * @param [noWebGL=false] {Boolean} prevents selection of WebGL renderer, even if such is present + * @param [noWebGL=false] {boolean} prevents selection of WebGL renderer, even if such is present * * @return {WebGLRenderer|CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer */ diff --git a/src/core/math/Matrix.js b/src/core/math/Matrix.js index ba28c1c..e625842 100644 --- a/src/core/math/Matrix.js +++ b/src/core/math/Matrix.js @@ -1,7 +1,7 @@ var Point = require('./Point'); /** - * The Matrix class is now an object, which makes it a lot faster, + * The pixi Matrix class as an object, which makes it a lot faster, * here is a representation of it : * | a | b | tx| * | c | d | ty| @@ -271,7 +271,11 @@ return this; }; - +/** + * Inverts this matrix + * + * @return {Matrix} This matrix. Good for chaining method calls. + */ Matrix.prototype.invert = function() { var a1 = this.a; @@ -309,7 +313,11 @@ return this; }; - +/** + * Creates a new Matrix object with the same values as this one. + * + * @return {Matrix} A copy of this matrix. Good for chaining method calls. + */ Matrix.prototype.clone = function () { var matrix = new Matrix(); @@ -323,6 +331,11 @@ return matrix; }; +/** + * Changes the values of the given matrix to be the same as the ones in this matrix + * + * @return {Matrix} The matrix given in parameter with its values updated. + */ Matrix.prototype.copy = function (matrix) { matrix.a = this.a; @@ -335,6 +348,11 @@ return matrix; }; - +/** + * A default (identity) matrix + */ Matrix.IDENTITY = new Matrix(); +/** + * A temp matrix + */ Matrix.TEMP_MATRIX = new Matrix(); diff --git a/src/core/math/shapes/RoundedRectangle.js b/src/core/math/shapes/RoundedRectangle.js index 7bf6411..7ec1eb4 100644 --- a/src/core/math/shapes/RoundedRectangle.js +++ b/src/core/math/shapes/RoundedRectangle.js @@ -1,7 +1,7 @@ var CONST = require('../../const'); /** - * The Rounded Rectangle object is an area defined by its position and has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height. + * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height and its radius. * * @class * @namespace PIXI diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 266221f..ef16ae1 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -152,7 +152,7 @@ if (index1 < 0 || index2 < 0) { - throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.'); + throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.'); } this.children[index1] = child2; @@ -199,14 +199,14 @@ /** * Returns the child at the specified index * - * @param index {Number} The index to get the child from + * @param index {Number} The index to get the child at * @return {DisplayObject} The child at the given index, if any. */ Container.prototype.getChildAt = function (index) { if (index < 0 || index >= this.children.length) { - throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); + throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller'); } return this.children[index]; @@ -280,13 +280,13 @@ }; /** - * Useful function that returns a texture of the displayObject object that can then be used to create sprites + * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} See {@link SCALE_MODES} for possible values - * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. - * @return {Texture} a texture of the graphics object + * @return {Texture} a texture of the display object */ Container.prototype.generateTexture = function (renderer, resolution, scaleMode) { @@ -488,9 +488,9 @@ } }; -Container.prototype._renderWebGL = function (/* renderer */) +Container.prototype._renderWebGL = function (renderer) { - // this is where content itself gets renderd.. + // this is where content itself gets rendered... }; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 243a75b..9b45b73 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -280,7 +280,7 @@ // temporary matrix variables var a, b, c, d, tx, ty; - // so if rotation is between 0 then we can simplify the multiplication process.. + // so if rotation is between 0 then we can simplify the multiplication process... if (this.rotation % math.PI_2) { // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes @@ -344,13 +344,12 @@ /** * * - * * Retrieves the bounds of the displayObject as a rectangle object * * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (/* matrix */) +DisplayObject.prototype.getBounds = function (matrix) { return math.Rectangle.EMPTY; }; @@ -373,7 +372,7 @@ */ DisplayObject.prototype.toGlobal = function (position) { - // don't need to u[date the lot + // don't need to update the lot this.displayObjectUpdateTransform(); return this.worldTransform.apply(position); }; @@ -403,7 +402,7 @@ * @param renderer {WebGLRenderer} The renderer * @private */ -DisplayObject.prototype.renderWebGL = function (/* renderer */) +DisplayObject.prototype.renderWebGL = function (renderer) { // OVERWRITE; }; @@ -414,11 +413,19 @@ * @param renderer {CanvasRenderer} The renderer * @private */ -DisplayObject.prototype.renderCanvas = function (/* renderer */) +DisplayObject.prototype.renderCanvas = function (renderer) { // OVERWRITE; }; - +/** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. + * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. + * @param resolution {Number} The resolution of the texture being generated + * @param scaleMode {Number} See {@link SCALE_MODES} for possible values + * @return {Texture} a texture of the display object + */ DisplayObject.prototype.generateTexture = function (renderer, resolution, scaleMode) { var bounds = this.getLocalBounds(); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index fea2126..bb1c13e 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -3,14 +3,13 @@ Texture = require('../textures/Texture'), CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'), CanvasGraphics = require('../renderers/canvas/utils/CanvasGraphics'), - // WebGLGraphics = require('../renderers/webgl/utils/WebGLGraphics'), GraphicsData = require('./GraphicsData'), math = require('../math'), CONST = require('../const'); /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and color and fill them. + * rectangles to the display, and to color and fill them. * * @class * @extends Container @@ -160,7 +159,7 @@ * * @return {Graphics} */ -GraphicsData.prototype.clone = function () +Graphics.prototype.clone = function () { var clone = new Graphics(); @@ -1069,7 +1068,7 @@ /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * - * @param {Circle|Rectangle|Ellipse|Line|Polygon} shape The Shape object to draw. + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. * @return {GraphicsData} The generated GraphicsData object. */ Graphics.prototype.drawShape = function (shape) diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 788f6f2..18e3b5c 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -3,6 +3,13 @@ * * @class * @namespace PIXI + * @param lineWidth {number} the width of the line to draw + * @param lineColor {number} the color of the line to draw + * @param lineAlpha {number} the alpha of the line to draw + * @param fillColor {number} the color of the fill + * @param fillAlpha {number} the alpha of the fill + * @param fill {boolean} whether or not the shape is filled with a colour + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index f0c5ffd..9dfcaad 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -11,6 +11,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this object renderer works for. */ function GraphicsRenderer(renderer) @@ -120,7 +121,6 @@ * * @private * @param graphicsData {Graphics} The graphics object to update - * @param gl {WebGLContext} the current WebGL drawing context */ GraphicsRenderer.prototype.updateGraphics = function(graphics) { @@ -251,8 +251,8 @@ * * * @private - * @param webGL {WebGLContext} - * @param type {number} + * @param webGL {WebGLRenderingContext} the current WebGL drawing context + * @param type {number} TODO @Alvin */ GraphicsRenderer.prototype.switchMode = function (webGL, type) { @@ -286,7 +286,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRectangle = function (graphicsData, webGLData) { @@ -352,7 +352,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRoundedRectangle = function (graphicsData, webGLData) { @@ -429,7 +429,7 @@ * @param cpY {number} Control point y * @param toX {number} Destination point x * @param toY {number} Destination point y - * @return {number[]} + * @return {number[]} an array of points */ GraphicsRenderer.prototype.quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY) { @@ -473,7 +473,7 @@ * * @private * @param graphicsData {Graphics} The graphics object to draw - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildCircle = function (graphicsData, webGLData) { @@ -554,7 +554,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildLine = function (graphicsData, webGLData) { @@ -769,7 +769,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildComplexPoly = function (graphicsData, webGLData) { @@ -831,7 +831,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildPoly = function (graphicsData, webGLData) { diff --git a/src/core/index.js b/src/core/index.js index 83721d5..b2893e6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -65,7 +65,7 @@ * @param [options.preserveDrawingBuffer=false] {boolean} enables drawing buffer preservation, enable this if you * need to call toDataUrl on the webgl context * @param [options.resolution=1] {number} the resolution of the renderer retina would be 2 - * @param [noWebGL=false] {Boolean} prevents selection of WebGL renderer, even if such is present + * @param [noWebGL=false] {boolean} prevents selection of WebGL renderer, even if such is present * * @return {WebGLRenderer|CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer */ diff --git a/src/core/math/Matrix.js b/src/core/math/Matrix.js index ba28c1c..e625842 100644 --- a/src/core/math/Matrix.js +++ b/src/core/math/Matrix.js @@ -1,7 +1,7 @@ var Point = require('./Point'); /** - * The Matrix class is now an object, which makes it a lot faster, + * The pixi Matrix class as an object, which makes it a lot faster, * here is a representation of it : * | a | b | tx| * | c | d | ty| @@ -271,7 +271,11 @@ return this; }; - +/** + * Inverts this matrix + * + * @return {Matrix} This matrix. Good for chaining method calls. + */ Matrix.prototype.invert = function() { var a1 = this.a; @@ -309,7 +313,11 @@ return this; }; - +/** + * Creates a new Matrix object with the same values as this one. + * + * @return {Matrix} A copy of this matrix. Good for chaining method calls. + */ Matrix.prototype.clone = function () { var matrix = new Matrix(); @@ -323,6 +331,11 @@ return matrix; }; +/** + * Changes the values of the given matrix to be the same as the ones in this matrix + * + * @return {Matrix} The matrix given in parameter with its values updated. + */ Matrix.prototype.copy = function (matrix) { matrix.a = this.a; @@ -335,6 +348,11 @@ return matrix; }; - +/** + * A default (identity) matrix + */ Matrix.IDENTITY = new Matrix(); +/** + * A temp matrix + */ Matrix.TEMP_MATRIX = new Matrix(); diff --git a/src/core/math/shapes/RoundedRectangle.js b/src/core/math/shapes/RoundedRectangle.js index 7bf6411..7ec1eb4 100644 --- a/src/core/math/shapes/RoundedRectangle.js +++ b/src/core/math/shapes/RoundedRectangle.js @@ -1,7 +1,7 @@ var CONST = require('../../const'); /** - * The Rounded Rectangle object is an area defined by its position and has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height. + * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height and its radius. * * @class * @namespace PIXI diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index e33f4f4..abc8317 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -78,7 +78,7 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} the current WebGL drawing context */ ParticleBuffer.prototype.initBuffers = function () { diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 266221f..ef16ae1 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -152,7 +152,7 @@ if (index1 < 0 || index2 < 0) { - throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.'); + throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.'); } this.children[index1] = child2; @@ -199,14 +199,14 @@ /** * Returns the child at the specified index * - * @param index {Number} The index to get the child from + * @param index {Number} The index to get the child at * @return {DisplayObject} The child at the given index, if any. */ Container.prototype.getChildAt = function (index) { if (index < 0 || index >= this.children.length) { - throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); + throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller'); } return this.children[index]; @@ -280,13 +280,13 @@ }; /** - * Useful function that returns a texture of the displayObject object that can then be used to create sprites + * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} See {@link SCALE_MODES} for possible values - * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. - * @return {Texture} a texture of the graphics object + * @return {Texture} a texture of the display object */ Container.prototype.generateTexture = function (renderer, resolution, scaleMode) { @@ -488,9 +488,9 @@ } }; -Container.prototype._renderWebGL = function (/* renderer */) +Container.prototype._renderWebGL = function (renderer) { - // this is where content itself gets renderd.. + // this is where content itself gets rendered... }; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 243a75b..9b45b73 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -280,7 +280,7 @@ // temporary matrix variables var a, b, c, d, tx, ty; - // so if rotation is between 0 then we can simplify the multiplication process.. + // so if rotation is between 0 then we can simplify the multiplication process... if (this.rotation % math.PI_2) { // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes @@ -344,13 +344,12 @@ /** * * - * * Retrieves the bounds of the displayObject as a rectangle object * * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (/* matrix */) +DisplayObject.prototype.getBounds = function (matrix) { return math.Rectangle.EMPTY; }; @@ -373,7 +372,7 @@ */ DisplayObject.prototype.toGlobal = function (position) { - // don't need to u[date the lot + // don't need to update the lot this.displayObjectUpdateTransform(); return this.worldTransform.apply(position); }; @@ -403,7 +402,7 @@ * @param renderer {WebGLRenderer} The renderer * @private */ -DisplayObject.prototype.renderWebGL = function (/* renderer */) +DisplayObject.prototype.renderWebGL = function (renderer) { // OVERWRITE; }; @@ -414,11 +413,19 @@ * @param renderer {CanvasRenderer} The renderer * @private */ -DisplayObject.prototype.renderCanvas = function (/* renderer */) +DisplayObject.prototype.renderCanvas = function (renderer) { // OVERWRITE; }; - +/** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. + * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. + * @param resolution {Number} The resolution of the texture being generated + * @param scaleMode {Number} See {@link SCALE_MODES} for possible values + * @return {Texture} a texture of the display object + */ DisplayObject.prototype.generateTexture = function (renderer, resolution, scaleMode) { var bounds = this.getLocalBounds(); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index fea2126..bb1c13e 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -3,14 +3,13 @@ Texture = require('../textures/Texture'), CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'), CanvasGraphics = require('../renderers/canvas/utils/CanvasGraphics'), - // WebGLGraphics = require('../renderers/webgl/utils/WebGLGraphics'), GraphicsData = require('./GraphicsData'), math = require('../math'), CONST = require('../const'); /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and color and fill them. + * rectangles to the display, and to color and fill them. * * @class * @extends Container @@ -160,7 +159,7 @@ * * @return {Graphics} */ -GraphicsData.prototype.clone = function () +Graphics.prototype.clone = function () { var clone = new Graphics(); @@ -1069,7 +1068,7 @@ /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * - * @param {Circle|Rectangle|Ellipse|Line|Polygon} shape The Shape object to draw. + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. * @return {GraphicsData} The generated GraphicsData object. */ Graphics.prototype.drawShape = function (shape) diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 788f6f2..18e3b5c 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -3,6 +3,13 @@ * * @class * @namespace PIXI + * @param lineWidth {number} the width of the line to draw + * @param lineColor {number} the color of the line to draw + * @param lineAlpha {number} the alpha of the line to draw + * @param fillColor {number} the color of the fill + * @param fillAlpha {number} the alpha of the fill + * @param fill {boolean} whether or not the shape is filled with a colour + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index f0c5ffd..9dfcaad 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -11,6 +11,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this object renderer works for. */ function GraphicsRenderer(renderer) @@ -120,7 +121,6 @@ * * @private * @param graphicsData {Graphics} The graphics object to update - * @param gl {WebGLContext} the current WebGL drawing context */ GraphicsRenderer.prototype.updateGraphics = function(graphics) { @@ -251,8 +251,8 @@ * * * @private - * @param webGL {WebGLContext} - * @param type {number} + * @param webGL {WebGLRenderingContext} the current WebGL drawing context + * @param type {number} TODO @Alvin */ GraphicsRenderer.prototype.switchMode = function (webGL, type) { @@ -286,7 +286,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRectangle = function (graphicsData, webGLData) { @@ -352,7 +352,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRoundedRectangle = function (graphicsData, webGLData) { @@ -429,7 +429,7 @@ * @param cpY {number} Control point y * @param toX {number} Destination point x * @param toY {number} Destination point y - * @return {number[]} + * @return {number[]} an array of points */ GraphicsRenderer.prototype.quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY) { @@ -473,7 +473,7 @@ * * @private * @param graphicsData {Graphics} The graphics object to draw - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildCircle = function (graphicsData, webGLData) { @@ -554,7 +554,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildLine = function (graphicsData, webGLData) { @@ -769,7 +769,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildComplexPoly = function (graphicsData, webGLData) { @@ -831,7 +831,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildPoly = function (graphicsData, webGLData) { diff --git a/src/core/index.js b/src/core/index.js index 83721d5..b2893e6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -65,7 +65,7 @@ * @param [options.preserveDrawingBuffer=false] {boolean} enables drawing buffer preservation, enable this if you * need to call toDataUrl on the webgl context * @param [options.resolution=1] {number} the resolution of the renderer retina would be 2 - * @param [noWebGL=false] {Boolean} prevents selection of WebGL renderer, even if such is present + * @param [noWebGL=false] {boolean} prevents selection of WebGL renderer, even if such is present * * @return {WebGLRenderer|CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer */ diff --git a/src/core/math/Matrix.js b/src/core/math/Matrix.js index ba28c1c..e625842 100644 --- a/src/core/math/Matrix.js +++ b/src/core/math/Matrix.js @@ -1,7 +1,7 @@ var Point = require('./Point'); /** - * The Matrix class is now an object, which makes it a lot faster, + * The pixi Matrix class as an object, which makes it a lot faster, * here is a representation of it : * | a | b | tx| * | c | d | ty| @@ -271,7 +271,11 @@ return this; }; - +/** + * Inverts this matrix + * + * @return {Matrix} This matrix. Good for chaining method calls. + */ Matrix.prototype.invert = function() { var a1 = this.a; @@ -309,7 +313,11 @@ return this; }; - +/** + * Creates a new Matrix object with the same values as this one. + * + * @return {Matrix} A copy of this matrix. Good for chaining method calls. + */ Matrix.prototype.clone = function () { var matrix = new Matrix(); @@ -323,6 +331,11 @@ return matrix; }; +/** + * Changes the values of the given matrix to be the same as the ones in this matrix + * + * @return {Matrix} The matrix given in parameter with its values updated. + */ Matrix.prototype.copy = function (matrix) { matrix.a = this.a; @@ -335,6 +348,11 @@ return matrix; }; - +/** + * A default (identity) matrix + */ Matrix.IDENTITY = new Matrix(); +/** + * A temp matrix + */ Matrix.TEMP_MATRIX = new Matrix(); diff --git a/src/core/math/shapes/RoundedRectangle.js b/src/core/math/shapes/RoundedRectangle.js index 7bf6411..7ec1eb4 100644 --- a/src/core/math/shapes/RoundedRectangle.js +++ b/src/core/math/shapes/RoundedRectangle.js @@ -1,7 +1,7 @@ var CONST = require('../../const'); /** - * The Rounded Rectangle object is an area defined by its position and has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height. + * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height and its radius. * * @class * @namespace PIXI diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index e33f4f4..abc8317 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -78,7 +78,7 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} the current WebGL drawing context */ ParticleBuffer.prototype.initBuffers = function () { diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 8c48ffb..56213f0 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -78,7 +78,7 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} the current WebGL drawing context */ ParticleRenderer.prototype.onContextChange = function () { diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 266221f..ef16ae1 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -152,7 +152,7 @@ if (index1 < 0 || index2 < 0) { - throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.'); + throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.'); } this.children[index1] = child2; @@ -199,14 +199,14 @@ /** * Returns the child at the specified index * - * @param index {Number} The index to get the child from + * @param index {Number} The index to get the child at * @return {DisplayObject} The child at the given index, if any. */ Container.prototype.getChildAt = function (index) { if (index < 0 || index >= this.children.length) { - throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); + throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller'); } return this.children[index]; @@ -280,13 +280,13 @@ }; /** - * Useful function that returns a texture of the displayObject object that can then be used to create sprites + * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} See {@link SCALE_MODES} for possible values - * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. - * @return {Texture} a texture of the graphics object + * @return {Texture} a texture of the display object */ Container.prototype.generateTexture = function (renderer, resolution, scaleMode) { @@ -488,9 +488,9 @@ } }; -Container.prototype._renderWebGL = function (/* renderer */) +Container.prototype._renderWebGL = function (renderer) { - // this is where content itself gets renderd.. + // this is where content itself gets rendered... }; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 243a75b..9b45b73 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -280,7 +280,7 @@ // temporary matrix variables var a, b, c, d, tx, ty; - // so if rotation is between 0 then we can simplify the multiplication process.. + // so if rotation is between 0 then we can simplify the multiplication process... if (this.rotation % math.PI_2) { // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes @@ -344,13 +344,12 @@ /** * * - * * Retrieves the bounds of the displayObject as a rectangle object * * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (/* matrix */) +DisplayObject.prototype.getBounds = function (matrix) { return math.Rectangle.EMPTY; }; @@ -373,7 +372,7 @@ */ DisplayObject.prototype.toGlobal = function (position) { - // don't need to u[date the lot + // don't need to update the lot this.displayObjectUpdateTransform(); return this.worldTransform.apply(position); }; @@ -403,7 +402,7 @@ * @param renderer {WebGLRenderer} The renderer * @private */ -DisplayObject.prototype.renderWebGL = function (/* renderer */) +DisplayObject.prototype.renderWebGL = function (renderer) { // OVERWRITE; }; @@ -414,11 +413,19 @@ * @param renderer {CanvasRenderer} The renderer * @private */ -DisplayObject.prototype.renderCanvas = function (/* renderer */) +DisplayObject.prototype.renderCanvas = function (renderer) { // OVERWRITE; }; - +/** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. + * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. + * @param resolution {Number} The resolution of the texture being generated + * @param scaleMode {Number} See {@link SCALE_MODES} for possible values + * @return {Texture} a texture of the display object + */ DisplayObject.prototype.generateTexture = function (renderer, resolution, scaleMode) { var bounds = this.getLocalBounds(); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index fea2126..bb1c13e 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -3,14 +3,13 @@ Texture = require('../textures/Texture'), CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'), CanvasGraphics = require('../renderers/canvas/utils/CanvasGraphics'), - // WebGLGraphics = require('../renderers/webgl/utils/WebGLGraphics'), GraphicsData = require('./GraphicsData'), math = require('../math'), CONST = require('../const'); /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and color and fill them. + * rectangles to the display, and to color and fill them. * * @class * @extends Container @@ -160,7 +159,7 @@ * * @return {Graphics} */ -GraphicsData.prototype.clone = function () +Graphics.prototype.clone = function () { var clone = new Graphics(); @@ -1069,7 +1068,7 @@ /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * - * @param {Circle|Rectangle|Ellipse|Line|Polygon} shape The Shape object to draw. + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. * @return {GraphicsData} The generated GraphicsData object. */ Graphics.prototype.drawShape = function (shape) diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 788f6f2..18e3b5c 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -3,6 +3,13 @@ * * @class * @namespace PIXI + * @param lineWidth {number} the width of the line to draw + * @param lineColor {number} the color of the line to draw + * @param lineAlpha {number} the alpha of the line to draw + * @param fillColor {number} the color of the fill + * @param fillAlpha {number} the alpha of the fill + * @param fill {boolean} whether or not the shape is filled with a colour + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index f0c5ffd..9dfcaad 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -11,6 +11,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this object renderer works for. */ function GraphicsRenderer(renderer) @@ -120,7 +121,6 @@ * * @private * @param graphicsData {Graphics} The graphics object to update - * @param gl {WebGLContext} the current WebGL drawing context */ GraphicsRenderer.prototype.updateGraphics = function(graphics) { @@ -251,8 +251,8 @@ * * * @private - * @param webGL {WebGLContext} - * @param type {number} + * @param webGL {WebGLRenderingContext} the current WebGL drawing context + * @param type {number} TODO @Alvin */ GraphicsRenderer.prototype.switchMode = function (webGL, type) { @@ -286,7 +286,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRectangle = function (graphicsData, webGLData) { @@ -352,7 +352,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRoundedRectangle = function (graphicsData, webGLData) { @@ -429,7 +429,7 @@ * @param cpY {number} Control point y * @param toX {number} Destination point x * @param toY {number} Destination point y - * @return {number[]} + * @return {number[]} an array of points */ GraphicsRenderer.prototype.quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY) { @@ -473,7 +473,7 @@ * * @private * @param graphicsData {Graphics} The graphics object to draw - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildCircle = function (graphicsData, webGLData) { @@ -554,7 +554,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildLine = function (graphicsData, webGLData) { @@ -769,7 +769,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildComplexPoly = function (graphicsData, webGLData) { @@ -831,7 +831,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildPoly = function (graphicsData, webGLData) { diff --git a/src/core/index.js b/src/core/index.js index 83721d5..b2893e6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -65,7 +65,7 @@ * @param [options.preserveDrawingBuffer=false] {boolean} enables drawing buffer preservation, enable this if you * need to call toDataUrl on the webgl context * @param [options.resolution=1] {number} the resolution of the renderer retina would be 2 - * @param [noWebGL=false] {Boolean} prevents selection of WebGL renderer, even if such is present + * @param [noWebGL=false] {boolean} prevents selection of WebGL renderer, even if such is present * * @return {WebGLRenderer|CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer */ diff --git a/src/core/math/Matrix.js b/src/core/math/Matrix.js index ba28c1c..e625842 100644 --- a/src/core/math/Matrix.js +++ b/src/core/math/Matrix.js @@ -1,7 +1,7 @@ var Point = require('./Point'); /** - * The Matrix class is now an object, which makes it a lot faster, + * The pixi Matrix class as an object, which makes it a lot faster, * here is a representation of it : * | a | b | tx| * | c | d | ty| @@ -271,7 +271,11 @@ return this; }; - +/** + * Inverts this matrix + * + * @return {Matrix} This matrix. Good for chaining method calls. + */ Matrix.prototype.invert = function() { var a1 = this.a; @@ -309,7 +313,11 @@ return this; }; - +/** + * Creates a new Matrix object with the same values as this one. + * + * @return {Matrix} A copy of this matrix. Good for chaining method calls. + */ Matrix.prototype.clone = function () { var matrix = new Matrix(); @@ -323,6 +331,11 @@ return matrix; }; +/** + * Changes the values of the given matrix to be the same as the ones in this matrix + * + * @return {Matrix} The matrix given in parameter with its values updated. + */ Matrix.prototype.copy = function (matrix) { matrix.a = this.a; @@ -335,6 +348,11 @@ return matrix; }; - +/** + * A default (identity) matrix + */ Matrix.IDENTITY = new Matrix(); +/** + * A temp matrix + */ Matrix.TEMP_MATRIX = new Matrix(); diff --git a/src/core/math/shapes/RoundedRectangle.js b/src/core/math/shapes/RoundedRectangle.js index 7bf6411..7ec1eb4 100644 --- a/src/core/math/shapes/RoundedRectangle.js +++ b/src/core/math/shapes/RoundedRectangle.js @@ -1,7 +1,7 @@ var CONST = require('../../const'); /** - * The Rounded Rectangle object is an area defined by its position and has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height. + * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height and its radius. * * @class * @namespace PIXI diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index e33f4f4..abc8317 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -78,7 +78,7 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} the current WebGL drawing context */ ParticleBuffer.prototype.initBuffers = function () { diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 8c48ffb..56213f0 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -78,7 +78,7 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} the current WebGL drawing context */ ParticleRenderer.prototype.onContextChange = function () { diff --git a/src/core/renderers/canvas/utils/CanvasBuffer.js b/src/core/renderers/canvas/utils/CanvasBuffer.js index ed9c248..7d06c36 100644 --- a/src/core/renderers/canvas/utils/CanvasBuffer.js +++ b/src/core/renderers/canvas/utils/CanvasBuffer.js @@ -87,6 +87,10 @@ this.canvas.height = height; }; +/** + * Destroys this canvas. + * + */ CanvasBuffer.prototype.destroy = function () { this.context = null; diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 266221f..ef16ae1 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -152,7 +152,7 @@ if (index1 < 0 || index2 < 0) { - throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.'); + throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.'); } this.children[index1] = child2; @@ -199,14 +199,14 @@ /** * Returns the child at the specified index * - * @param index {Number} The index to get the child from + * @param index {Number} The index to get the child at * @return {DisplayObject} The child at the given index, if any. */ Container.prototype.getChildAt = function (index) { if (index < 0 || index >= this.children.length) { - throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); + throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller'); } return this.children[index]; @@ -280,13 +280,13 @@ }; /** - * Useful function that returns a texture of the displayObject object that can then be used to create sprites + * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} See {@link SCALE_MODES} for possible values - * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. - * @return {Texture} a texture of the graphics object + * @return {Texture} a texture of the display object */ Container.prototype.generateTexture = function (renderer, resolution, scaleMode) { @@ -488,9 +488,9 @@ } }; -Container.prototype._renderWebGL = function (/* renderer */) +Container.prototype._renderWebGL = function (renderer) { - // this is where content itself gets renderd.. + // this is where content itself gets rendered... }; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 243a75b..9b45b73 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -280,7 +280,7 @@ // temporary matrix variables var a, b, c, d, tx, ty; - // so if rotation is between 0 then we can simplify the multiplication process.. + // so if rotation is between 0 then we can simplify the multiplication process... if (this.rotation % math.PI_2) { // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes @@ -344,13 +344,12 @@ /** * * - * * Retrieves the bounds of the displayObject as a rectangle object * * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (/* matrix */) +DisplayObject.prototype.getBounds = function (matrix) { return math.Rectangle.EMPTY; }; @@ -373,7 +372,7 @@ */ DisplayObject.prototype.toGlobal = function (position) { - // don't need to u[date the lot + // don't need to update the lot this.displayObjectUpdateTransform(); return this.worldTransform.apply(position); }; @@ -403,7 +402,7 @@ * @param renderer {WebGLRenderer} The renderer * @private */ -DisplayObject.prototype.renderWebGL = function (/* renderer */) +DisplayObject.prototype.renderWebGL = function (renderer) { // OVERWRITE; }; @@ -414,11 +413,19 @@ * @param renderer {CanvasRenderer} The renderer * @private */ -DisplayObject.prototype.renderCanvas = function (/* renderer */) +DisplayObject.prototype.renderCanvas = function (renderer) { // OVERWRITE; }; - +/** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. + * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. + * @param resolution {Number} The resolution of the texture being generated + * @param scaleMode {Number} See {@link SCALE_MODES} for possible values + * @return {Texture} a texture of the display object + */ DisplayObject.prototype.generateTexture = function (renderer, resolution, scaleMode) { var bounds = this.getLocalBounds(); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index fea2126..bb1c13e 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -3,14 +3,13 @@ Texture = require('../textures/Texture'), CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'), CanvasGraphics = require('../renderers/canvas/utils/CanvasGraphics'), - // WebGLGraphics = require('../renderers/webgl/utils/WebGLGraphics'), GraphicsData = require('./GraphicsData'), math = require('../math'), CONST = require('../const'); /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and color and fill them. + * rectangles to the display, and to color and fill them. * * @class * @extends Container @@ -160,7 +159,7 @@ * * @return {Graphics} */ -GraphicsData.prototype.clone = function () +Graphics.prototype.clone = function () { var clone = new Graphics(); @@ -1069,7 +1068,7 @@ /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * - * @param {Circle|Rectangle|Ellipse|Line|Polygon} shape The Shape object to draw. + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. * @return {GraphicsData} The generated GraphicsData object. */ Graphics.prototype.drawShape = function (shape) diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 788f6f2..18e3b5c 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -3,6 +3,13 @@ * * @class * @namespace PIXI + * @param lineWidth {number} the width of the line to draw + * @param lineColor {number} the color of the line to draw + * @param lineAlpha {number} the alpha of the line to draw + * @param fillColor {number} the color of the fill + * @param fillAlpha {number} the alpha of the fill + * @param fill {boolean} whether or not the shape is filled with a colour + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index f0c5ffd..9dfcaad 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -11,6 +11,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this object renderer works for. */ function GraphicsRenderer(renderer) @@ -120,7 +121,6 @@ * * @private * @param graphicsData {Graphics} The graphics object to update - * @param gl {WebGLContext} the current WebGL drawing context */ GraphicsRenderer.prototype.updateGraphics = function(graphics) { @@ -251,8 +251,8 @@ * * * @private - * @param webGL {WebGLContext} - * @param type {number} + * @param webGL {WebGLRenderingContext} the current WebGL drawing context + * @param type {number} TODO @Alvin */ GraphicsRenderer.prototype.switchMode = function (webGL, type) { @@ -286,7 +286,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRectangle = function (graphicsData, webGLData) { @@ -352,7 +352,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRoundedRectangle = function (graphicsData, webGLData) { @@ -429,7 +429,7 @@ * @param cpY {number} Control point y * @param toX {number} Destination point x * @param toY {number} Destination point y - * @return {number[]} + * @return {number[]} an array of points */ GraphicsRenderer.prototype.quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY) { @@ -473,7 +473,7 @@ * * @private * @param graphicsData {Graphics} The graphics object to draw - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildCircle = function (graphicsData, webGLData) { @@ -554,7 +554,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildLine = function (graphicsData, webGLData) { @@ -769,7 +769,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildComplexPoly = function (graphicsData, webGLData) { @@ -831,7 +831,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildPoly = function (graphicsData, webGLData) { diff --git a/src/core/index.js b/src/core/index.js index 83721d5..b2893e6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -65,7 +65,7 @@ * @param [options.preserveDrawingBuffer=false] {boolean} enables drawing buffer preservation, enable this if you * need to call toDataUrl on the webgl context * @param [options.resolution=1] {number} the resolution of the renderer retina would be 2 - * @param [noWebGL=false] {Boolean} prevents selection of WebGL renderer, even if such is present + * @param [noWebGL=false] {boolean} prevents selection of WebGL renderer, even if such is present * * @return {WebGLRenderer|CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer */ diff --git a/src/core/math/Matrix.js b/src/core/math/Matrix.js index ba28c1c..e625842 100644 --- a/src/core/math/Matrix.js +++ b/src/core/math/Matrix.js @@ -1,7 +1,7 @@ var Point = require('./Point'); /** - * The Matrix class is now an object, which makes it a lot faster, + * The pixi Matrix class as an object, which makes it a lot faster, * here is a representation of it : * | a | b | tx| * | c | d | ty| @@ -271,7 +271,11 @@ return this; }; - +/** + * Inverts this matrix + * + * @return {Matrix} This matrix. Good for chaining method calls. + */ Matrix.prototype.invert = function() { var a1 = this.a; @@ -309,7 +313,11 @@ return this; }; - +/** + * Creates a new Matrix object with the same values as this one. + * + * @return {Matrix} A copy of this matrix. Good for chaining method calls. + */ Matrix.prototype.clone = function () { var matrix = new Matrix(); @@ -323,6 +331,11 @@ return matrix; }; +/** + * Changes the values of the given matrix to be the same as the ones in this matrix + * + * @return {Matrix} The matrix given in parameter with its values updated. + */ Matrix.prototype.copy = function (matrix) { matrix.a = this.a; @@ -335,6 +348,11 @@ return matrix; }; - +/** + * A default (identity) matrix + */ Matrix.IDENTITY = new Matrix(); +/** + * A temp matrix + */ Matrix.TEMP_MATRIX = new Matrix(); diff --git a/src/core/math/shapes/RoundedRectangle.js b/src/core/math/shapes/RoundedRectangle.js index 7bf6411..7ec1eb4 100644 --- a/src/core/math/shapes/RoundedRectangle.js +++ b/src/core/math/shapes/RoundedRectangle.js @@ -1,7 +1,7 @@ var CONST = require('../../const'); /** - * The Rounded Rectangle object is an area defined by its position and has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height. + * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height and its radius. * * @class * @namespace PIXI diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index e33f4f4..abc8317 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -78,7 +78,7 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} the current WebGL drawing context */ ParticleBuffer.prototype.initBuffers = function () { diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 8c48ffb..56213f0 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -78,7 +78,7 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} the current WebGL drawing context */ ParticleRenderer.prototype.onContextChange = function () { diff --git a/src/core/renderers/canvas/utils/CanvasBuffer.js b/src/core/renderers/canvas/utils/CanvasBuffer.js index ed9c248..7d06c36 100644 --- a/src/core/renderers/canvas/utils/CanvasBuffer.js +++ b/src/core/renderers/canvas/utils/CanvasBuffer.js @@ -87,6 +87,10 @@ this.canvas.height = height; }; +/** + * Destroys this canvas. + * + */ CanvasBuffer.prototype.destroy = function () { this.context = null; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index db2baee..73b785e 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -24,7 +24,7 @@ this.uuid = utils.uuid(); /** - * @member {WebGLContext} + * @member {WebGLRenderingContext} * @readonly */ this.gl = shaderManager.renderer.gl; diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 266221f..ef16ae1 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -152,7 +152,7 @@ if (index1 < 0 || index2 < 0) { - throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.'); + throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.'); } this.children[index1] = child2; @@ -199,14 +199,14 @@ /** * Returns the child at the specified index * - * @param index {Number} The index to get the child from + * @param index {Number} The index to get the child at * @return {DisplayObject} The child at the given index, if any. */ Container.prototype.getChildAt = function (index) { if (index < 0 || index >= this.children.length) { - throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); + throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller'); } return this.children[index]; @@ -280,13 +280,13 @@ }; /** - * Useful function that returns a texture of the displayObject object that can then be used to create sprites + * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} See {@link SCALE_MODES} for possible values - * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. - * @return {Texture} a texture of the graphics object + * @return {Texture} a texture of the display object */ Container.prototype.generateTexture = function (renderer, resolution, scaleMode) { @@ -488,9 +488,9 @@ } }; -Container.prototype._renderWebGL = function (/* renderer */) +Container.prototype._renderWebGL = function (renderer) { - // this is where content itself gets renderd.. + // this is where content itself gets rendered... }; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 243a75b..9b45b73 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -280,7 +280,7 @@ // temporary matrix variables var a, b, c, d, tx, ty; - // so if rotation is between 0 then we can simplify the multiplication process.. + // so if rotation is between 0 then we can simplify the multiplication process... if (this.rotation % math.PI_2) { // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes @@ -344,13 +344,12 @@ /** * * - * * Retrieves the bounds of the displayObject as a rectangle object * * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (/* matrix */) +DisplayObject.prototype.getBounds = function (matrix) { return math.Rectangle.EMPTY; }; @@ -373,7 +372,7 @@ */ DisplayObject.prototype.toGlobal = function (position) { - // don't need to u[date the lot + // don't need to update the lot this.displayObjectUpdateTransform(); return this.worldTransform.apply(position); }; @@ -403,7 +402,7 @@ * @param renderer {WebGLRenderer} The renderer * @private */ -DisplayObject.prototype.renderWebGL = function (/* renderer */) +DisplayObject.prototype.renderWebGL = function (renderer) { // OVERWRITE; }; @@ -414,11 +413,19 @@ * @param renderer {CanvasRenderer} The renderer * @private */ -DisplayObject.prototype.renderCanvas = function (/* renderer */) +DisplayObject.prototype.renderCanvas = function (renderer) { // OVERWRITE; }; - +/** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. + * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. + * @param resolution {Number} The resolution of the texture being generated + * @param scaleMode {Number} See {@link SCALE_MODES} for possible values + * @return {Texture} a texture of the display object + */ DisplayObject.prototype.generateTexture = function (renderer, resolution, scaleMode) { var bounds = this.getLocalBounds(); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index fea2126..bb1c13e 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -3,14 +3,13 @@ Texture = require('../textures/Texture'), CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'), CanvasGraphics = require('../renderers/canvas/utils/CanvasGraphics'), - // WebGLGraphics = require('../renderers/webgl/utils/WebGLGraphics'), GraphicsData = require('./GraphicsData'), math = require('../math'), CONST = require('../const'); /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and color and fill them. + * rectangles to the display, and to color and fill them. * * @class * @extends Container @@ -160,7 +159,7 @@ * * @return {Graphics} */ -GraphicsData.prototype.clone = function () +Graphics.prototype.clone = function () { var clone = new Graphics(); @@ -1069,7 +1068,7 @@ /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * - * @param {Circle|Rectangle|Ellipse|Line|Polygon} shape The Shape object to draw. + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. * @return {GraphicsData} The generated GraphicsData object. */ Graphics.prototype.drawShape = function (shape) diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 788f6f2..18e3b5c 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -3,6 +3,13 @@ * * @class * @namespace PIXI + * @param lineWidth {number} the width of the line to draw + * @param lineColor {number} the color of the line to draw + * @param lineAlpha {number} the alpha of the line to draw + * @param fillColor {number} the color of the fill + * @param fillAlpha {number} the alpha of the fill + * @param fill {boolean} whether or not the shape is filled with a colour + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index f0c5ffd..9dfcaad 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -11,6 +11,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this object renderer works for. */ function GraphicsRenderer(renderer) @@ -120,7 +121,6 @@ * * @private * @param graphicsData {Graphics} The graphics object to update - * @param gl {WebGLContext} the current WebGL drawing context */ GraphicsRenderer.prototype.updateGraphics = function(graphics) { @@ -251,8 +251,8 @@ * * * @private - * @param webGL {WebGLContext} - * @param type {number} + * @param webGL {WebGLRenderingContext} the current WebGL drawing context + * @param type {number} TODO @Alvin */ GraphicsRenderer.prototype.switchMode = function (webGL, type) { @@ -286,7 +286,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRectangle = function (graphicsData, webGLData) { @@ -352,7 +352,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRoundedRectangle = function (graphicsData, webGLData) { @@ -429,7 +429,7 @@ * @param cpY {number} Control point y * @param toX {number} Destination point x * @param toY {number} Destination point y - * @return {number[]} + * @return {number[]} an array of points */ GraphicsRenderer.prototype.quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY) { @@ -473,7 +473,7 @@ * * @private * @param graphicsData {Graphics} The graphics object to draw - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildCircle = function (graphicsData, webGLData) { @@ -554,7 +554,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildLine = function (graphicsData, webGLData) { @@ -769,7 +769,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildComplexPoly = function (graphicsData, webGLData) { @@ -831,7 +831,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildPoly = function (graphicsData, webGLData) { diff --git a/src/core/index.js b/src/core/index.js index 83721d5..b2893e6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -65,7 +65,7 @@ * @param [options.preserveDrawingBuffer=false] {boolean} enables drawing buffer preservation, enable this if you * need to call toDataUrl on the webgl context * @param [options.resolution=1] {number} the resolution of the renderer retina would be 2 - * @param [noWebGL=false] {Boolean} prevents selection of WebGL renderer, even if such is present + * @param [noWebGL=false] {boolean} prevents selection of WebGL renderer, even if such is present * * @return {WebGLRenderer|CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer */ diff --git a/src/core/math/Matrix.js b/src/core/math/Matrix.js index ba28c1c..e625842 100644 --- a/src/core/math/Matrix.js +++ b/src/core/math/Matrix.js @@ -1,7 +1,7 @@ var Point = require('./Point'); /** - * The Matrix class is now an object, which makes it a lot faster, + * The pixi Matrix class as an object, which makes it a lot faster, * here is a representation of it : * | a | b | tx| * | c | d | ty| @@ -271,7 +271,11 @@ return this; }; - +/** + * Inverts this matrix + * + * @return {Matrix} This matrix. Good for chaining method calls. + */ Matrix.prototype.invert = function() { var a1 = this.a; @@ -309,7 +313,11 @@ return this; }; - +/** + * Creates a new Matrix object with the same values as this one. + * + * @return {Matrix} A copy of this matrix. Good for chaining method calls. + */ Matrix.prototype.clone = function () { var matrix = new Matrix(); @@ -323,6 +331,11 @@ return matrix; }; +/** + * Changes the values of the given matrix to be the same as the ones in this matrix + * + * @return {Matrix} The matrix given in parameter with its values updated. + */ Matrix.prototype.copy = function (matrix) { matrix.a = this.a; @@ -335,6 +348,11 @@ return matrix; }; - +/** + * A default (identity) matrix + */ Matrix.IDENTITY = new Matrix(); +/** + * A temp matrix + */ Matrix.TEMP_MATRIX = new Matrix(); diff --git a/src/core/math/shapes/RoundedRectangle.js b/src/core/math/shapes/RoundedRectangle.js index 7bf6411..7ec1eb4 100644 --- a/src/core/math/shapes/RoundedRectangle.js +++ b/src/core/math/shapes/RoundedRectangle.js @@ -1,7 +1,7 @@ var CONST = require('../../const'); /** - * The Rounded Rectangle object is an area defined by its position and has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height. + * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height and its radius. * * @class * @namespace PIXI diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index e33f4f4..abc8317 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -78,7 +78,7 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} the current WebGL drawing context */ ParticleBuffer.prototype.initBuffers = function () { diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 8c48ffb..56213f0 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -78,7 +78,7 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} the current WebGL drawing context */ ParticleRenderer.prototype.onContextChange = function () { diff --git a/src/core/renderers/canvas/utils/CanvasBuffer.js b/src/core/renderers/canvas/utils/CanvasBuffer.js index ed9c248..7d06c36 100644 --- a/src/core/renderers/canvas/utils/CanvasBuffer.js +++ b/src/core/renderers/canvas/utils/CanvasBuffer.js @@ -87,6 +87,10 @@ this.canvas.height = height; }; +/** + * Destroys this canvas. + * + */ CanvasBuffer.prototype.destroy = function () { this.context = null; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index db2baee..73b785e 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -24,7 +24,7 @@ this.uuid = utils.uuid(); /** - * @member {WebGLContext} + * @member {WebGLRenderingContext} * @readonly */ this.gl = shaderManager.renderer.gl; diff --git a/src/core/renderers/webgl/utils/RenderTarget.js b/src/core/renderers/webgl/utils/RenderTarget.js index 97d7af1..c64e306 100644 --- a/src/core/renderers/webgl/utils/RenderTarget.js +++ b/src/core/renderers/webgl/utils/RenderTarget.js @@ -11,7 +11,7 @@ /** * @class FrameBuffer * @constructor -* @param gl {WebGLContext} the current WebGL drawing context +* @param gl {WebGLRenderingContext} the current WebGL drawing context * @param width {Number} the horizontal range of the filter * @param height {Number} the vertical range of the filter * @param scaleMode {Number} See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values @@ -22,7 +22,7 @@ /** * @property gl - * @type WebGLContext + * @type WebGLRenderingContext */ this.gl = gl; diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 266221f..ef16ae1 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -152,7 +152,7 @@ if (index1 < 0 || index2 < 0) { - throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.'); + throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.'); } this.children[index1] = child2; @@ -199,14 +199,14 @@ /** * Returns the child at the specified index * - * @param index {Number} The index to get the child from + * @param index {Number} The index to get the child at * @return {DisplayObject} The child at the given index, if any. */ Container.prototype.getChildAt = function (index) { if (index < 0 || index >= this.children.length) { - throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); + throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller'); } return this.children[index]; @@ -280,13 +280,13 @@ }; /** - * Useful function that returns a texture of the displayObject object that can then be used to create sprites + * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} See {@link SCALE_MODES} for possible values - * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. - * @return {Texture} a texture of the graphics object + * @return {Texture} a texture of the display object */ Container.prototype.generateTexture = function (renderer, resolution, scaleMode) { @@ -488,9 +488,9 @@ } }; -Container.prototype._renderWebGL = function (/* renderer */) +Container.prototype._renderWebGL = function (renderer) { - // this is where content itself gets renderd.. + // this is where content itself gets rendered... }; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 243a75b..9b45b73 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -280,7 +280,7 @@ // temporary matrix variables var a, b, c, d, tx, ty; - // so if rotation is between 0 then we can simplify the multiplication process.. + // so if rotation is between 0 then we can simplify the multiplication process... if (this.rotation % math.PI_2) { // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes @@ -344,13 +344,12 @@ /** * * - * * Retrieves the bounds of the displayObject as a rectangle object * * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (/* matrix */) +DisplayObject.prototype.getBounds = function (matrix) { return math.Rectangle.EMPTY; }; @@ -373,7 +372,7 @@ */ DisplayObject.prototype.toGlobal = function (position) { - // don't need to u[date the lot + // don't need to update the lot this.displayObjectUpdateTransform(); return this.worldTransform.apply(position); }; @@ -403,7 +402,7 @@ * @param renderer {WebGLRenderer} The renderer * @private */ -DisplayObject.prototype.renderWebGL = function (/* renderer */) +DisplayObject.prototype.renderWebGL = function (renderer) { // OVERWRITE; }; @@ -414,11 +413,19 @@ * @param renderer {CanvasRenderer} The renderer * @private */ -DisplayObject.prototype.renderCanvas = function (/* renderer */) +DisplayObject.prototype.renderCanvas = function (renderer) { // OVERWRITE; }; - +/** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. + * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. + * @param resolution {Number} The resolution of the texture being generated + * @param scaleMode {Number} See {@link SCALE_MODES} for possible values + * @return {Texture} a texture of the display object + */ DisplayObject.prototype.generateTexture = function (renderer, resolution, scaleMode) { var bounds = this.getLocalBounds(); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index fea2126..bb1c13e 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -3,14 +3,13 @@ Texture = require('../textures/Texture'), CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'), CanvasGraphics = require('../renderers/canvas/utils/CanvasGraphics'), - // WebGLGraphics = require('../renderers/webgl/utils/WebGLGraphics'), GraphicsData = require('./GraphicsData'), math = require('../math'), CONST = require('../const'); /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and color and fill them. + * rectangles to the display, and to color and fill them. * * @class * @extends Container @@ -160,7 +159,7 @@ * * @return {Graphics} */ -GraphicsData.prototype.clone = function () +Graphics.prototype.clone = function () { var clone = new Graphics(); @@ -1069,7 +1068,7 @@ /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * - * @param {Circle|Rectangle|Ellipse|Line|Polygon} shape The Shape object to draw. + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. * @return {GraphicsData} The generated GraphicsData object. */ Graphics.prototype.drawShape = function (shape) diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 788f6f2..18e3b5c 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -3,6 +3,13 @@ * * @class * @namespace PIXI + * @param lineWidth {number} the width of the line to draw + * @param lineColor {number} the color of the line to draw + * @param lineAlpha {number} the alpha of the line to draw + * @param fillColor {number} the color of the fill + * @param fillAlpha {number} the alpha of the fill + * @param fill {boolean} whether or not the shape is filled with a colour + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index f0c5ffd..9dfcaad 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -11,6 +11,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this object renderer works for. */ function GraphicsRenderer(renderer) @@ -120,7 +121,6 @@ * * @private * @param graphicsData {Graphics} The graphics object to update - * @param gl {WebGLContext} the current WebGL drawing context */ GraphicsRenderer.prototype.updateGraphics = function(graphics) { @@ -251,8 +251,8 @@ * * * @private - * @param webGL {WebGLContext} - * @param type {number} + * @param webGL {WebGLRenderingContext} the current WebGL drawing context + * @param type {number} TODO @Alvin */ GraphicsRenderer.prototype.switchMode = function (webGL, type) { @@ -286,7 +286,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRectangle = function (graphicsData, webGLData) { @@ -352,7 +352,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRoundedRectangle = function (graphicsData, webGLData) { @@ -429,7 +429,7 @@ * @param cpY {number} Control point y * @param toX {number} Destination point x * @param toY {number} Destination point y - * @return {number[]} + * @return {number[]} an array of points */ GraphicsRenderer.prototype.quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY) { @@ -473,7 +473,7 @@ * * @private * @param graphicsData {Graphics} The graphics object to draw - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildCircle = function (graphicsData, webGLData) { @@ -554,7 +554,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildLine = function (graphicsData, webGLData) { @@ -769,7 +769,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildComplexPoly = function (graphicsData, webGLData) { @@ -831,7 +831,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildPoly = function (graphicsData, webGLData) { diff --git a/src/core/index.js b/src/core/index.js index 83721d5..b2893e6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -65,7 +65,7 @@ * @param [options.preserveDrawingBuffer=false] {boolean} enables drawing buffer preservation, enable this if you * need to call toDataUrl on the webgl context * @param [options.resolution=1] {number} the resolution of the renderer retina would be 2 - * @param [noWebGL=false] {Boolean} prevents selection of WebGL renderer, even if such is present + * @param [noWebGL=false] {boolean} prevents selection of WebGL renderer, even if such is present * * @return {WebGLRenderer|CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer */ diff --git a/src/core/math/Matrix.js b/src/core/math/Matrix.js index ba28c1c..e625842 100644 --- a/src/core/math/Matrix.js +++ b/src/core/math/Matrix.js @@ -1,7 +1,7 @@ var Point = require('./Point'); /** - * The Matrix class is now an object, which makes it a lot faster, + * The pixi Matrix class as an object, which makes it a lot faster, * here is a representation of it : * | a | b | tx| * | c | d | ty| @@ -271,7 +271,11 @@ return this; }; - +/** + * Inverts this matrix + * + * @return {Matrix} This matrix. Good for chaining method calls. + */ Matrix.prototype.invert = function() { var a1 = this.a; @@ -309,7 +313,11 @@ return this; }; - +/** + * Creates a new Matrix object with the same values as this one. + * + * @return {Matrix} A copy of this matrix. Good for chaining method calls. + */ Matrix.prototype.clone = function () { var matrix = new Matrix(); @@ -323,6 +331,11 @@ return matrix; }; +/** + * Changes the values of the given matrix to be the same as the ones in this matrix + * + * @return {Matrix} The matrix given in parameter with its values updated. + */ Matrix.prototype.copy = function (matrix) { matrix.a = this.a; @@ -335,6 +348,11 @@ return matrix; }; - +/** + * A default (identity) matrix + */ Matrix.IDENTITY = new Matrix(); +/** + * A temp matrix + */ Matrix.TEMP_MATRIX = new Matrix(); diff --git a/src/core/math/shapes/RoundedRectangle.js b/src/core/math/shapes/RoundedRectangle.js index 7bf6411..7ec1eb4 100644 --- a/src/core/math/shapes/RoundedRectangle.js +++ b/src/core/math/shapes/RoundedRectangle.js @@ -1,7 +1,7 @@ var CONST = require('../../const'); /** - * The Rounded Rectangle object is an area defined by its position and has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height. + * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height and its radius. * * @class * @namespace PIXI diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index e33f4f4..abc8317 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -78,7 +78,7 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} the current WebGL drawing context */ ParticleBuffer.prototype.initBuffers = function () { diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 8c48ffb..56213f0 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -78,7 +78,7 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} the current WebGL drawing context */ ParticleRenderer.prototype.onContextChange = function () { diff --git a/src/core/renderers/canvas/utils/CanvasBuffer.js b/src/core/renderers/canvas/utils/CanvasBuffer.js index ed9c248..7d06c36 100644 --- a/src/core/renderers/canvas/utils/CanvasBuffer.js +++ b/src/core/renderers/canvas/utils/CanvasBuffer.js @@ -87,6 +87,10 @@ this.canvas.height = height; }; +/** + * Destroys this canvas. + * + */ CanvasBuffer.prototype.destroy = function () { this.context = null; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index db2baee..73b785e 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -24,7 +24,7 @@ this.uuid = utils.uuid(); /** - * @member {WebGLContext} + * @member {WebGLRenderingContext} * @readonly */ this.gl = shaderManager.renderer.gl; diff --git a/src/core/renderers/webgl/utils/RenderTarget.js b/src/core/renderers/webgl/utils/RenderTarget.js index 97d7af1..c64e306 100644 --- a/src/core/renderers/webgl/utils/RenderTarget.js +++ b/src/core/renderers/webgl/utils/RenderTarget.js @@ -11,7 +11,7 @@ /** * @class FrameBuffer * @constructor -* @param gl {WebGLContext} the current WebGL drawing context +* @param gl {WebGLRenderingContext} the current WebGL drawing context * @param width {Number} the horizontal range of the filter * @param height {Number} the vertical range of the filter * @param scaleMode {Number} See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values @@ -22,7 +22,7 @@ /** * @property gl - * @type WebGLContext + * @type WebGLRenderingContext */ this.gl = gl; diff --git a/src/core/sprites/Sprite.js b/src/core/sprites/Sprite.js index 0586999..28c6e9c 100644 --- a/src/core/sprites/Sprite.js +++ b/src/core/sprites/Sprite.js @@ -26,8 +26,8 @@ /** * The anchor sets the origin point of the texture. * The default is 0,0 this means the texture's origin is the top left - * Setting than anchor to 0.5,0.5 means the textures origin is centered - * Setting the anchor to 1,1 would mean the textures origin points will be the bottom right corner + * Setting the anchor to 0.5,0.5 means the texture's origin is centered + * Setting the anchor to 1,1 would mean the texture's origin point will be the bottom right corner * * @member {Point} */ @@ -86,6 +86,12 @@ this.texture = texture || Texture.EMPTY; } +/** + * Destroys this sprite and optionally its texture + * + * @param destroyTexture {boolean} Should it destroy the current texture of the sprite as well + * @param destroyBaseTexture {boolean} Should it destroy the base texture of the sprite as well + */ Sprite.prototype.destroy = function (destroyTexture, destroyBaseTexture) { Container.prototype.destroy.call(this); @@ -199,6 +205,12 @@ } }; +/** + +* Renders the object using the WebGL renderer +* +* @param renderer {WebGLRenderer} +*/ Sprite.prototype._renderWebGL = function (renderer) { renderer.setObjectRenderer(renderer.plugins.sprite); diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 266221f..ef16ae1 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -152,7 +152,7 @@ if (index1 < 0 || index2 < 0) { - throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.'); + throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.'); } this.children[index1] = child2; @@ -199,14 +199,14 @@ /** * Returns the child at the specified index * - * @param index {Number} The index to get the child from + * @param index {Number} The index to get the child at * @return {DisplayObject} The child at the given index, if any. */ Container.prototype.getChildAt = function (index) { if (index < 0 || index >= this.children.length) { - throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); + throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller'); } return this.children[index]; @@ -280,13 +280,13 @@ }; /** - * Useful function that returns a texture of the displayObject object that can then be used to create sprites + * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} See {@link SCALE_MODES} for possible values - * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. - * @return {Texture} a texture of the graphics object + * @return {Texture} a texture of the display object */ Container.prototype.generateTexture = function (renderer, resolution, scaleMode) { @@ -488,9 +488,9 @@ } }; -Container.prototype._renderWebGL = function (/* renderer */) +Container.prototype._renderWebGL = function (renderer) { - // this is where content itself gets renderd.. + // this is where content itself gets rendered... }; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index 243a75b..9b45b73 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -280,7 +280,7 @@ // temporary matrix variables var a, b, c, d, tx, ty; - // so if rotation is between 0 then we can simplify the multiplication process.. + // so if rotation is between 0 then we can simplify the multiplication process... if (this.rotation % math.PI_2) { // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes @@ -344,13 +344,12 @@ /** * * - * * Retrieves the bounds of the displayObject as a rectangle object * * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (/* matrix */) +DisplayObject.prototype.getBounds = function (matrix) { return math.Rectangle.EMPTY; }; @@ -373,7 +372,7 @@ */ DisplayObject.prototype.toGlobal = function (position) { - // don't need to u[date the lot + // don't need to update the lot this.displayObjectUpdateTransform(); return this.worldTransform.apply(position); }; @@ -403,7 +402,7 @@ * @param renderer {WebGLRenderer} The renderer * @private */ -DisplayObject.prototype.renderWebGL = function (/* renderer */) +DisplayObject.prototype.renderWebGL = function (renderer) { // OVERWRITE; }; @@ -414,11 +413,19 @@ * @param renderer {CanvasRenderer} The renderer * @private */ -DisplayObject.prototype.renderCanvas = function (/* renderer */) +DisplayObject.prototype.renderCanvas = function (renderer) { // OVERWRITE; }; - +/** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times. + * + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. + * @param resolution {Number} The resolution of the texture being generated + * @param scaleMode {Number} See {@link SCALE_MODES} for possible values + * @return {Texture} a texture of the display object + */ DisplayObject.prototype.generateTexture = function (renderer, resolution, scaleMode) { var bounds = this.getLocalBounds(); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index fea2126..bb1c13e 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -3,14 +3,13 @@ Texture = require('../textures/Texture'), CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'), CanvasGraphics = require('../renderers/canvas/utils/CanvasGraphics'), - // WebGLGraphics = require('../renderers/webgl/utils/WebGLGraphics'), GraphicsData = require('./GraphicsData'), math = require('../math'), CONST = require('../const'); /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and color and fill them. + * rectangles to the display, and to color and fill them. * * @class * @extends Container @@ -160,7 +159,7 @@ * * @return {Graphics} */ -GraphicsData.prototype.clone = function () +Graphics.prototype.clone = function () { var clone = new Graphics(); @@ -1069,7 +1068,7 @@ /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * - * @param {Circle|Rectangle|Ellipse|Line|Polygon} shape The Shape object to draw. + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. * @return {GraphicsData} The generated GraphicsData object. */ Graphics.prototype.drawShape = function (shape) diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 788f6f2..18e3b5c 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -3,6 +3,13 @@ * * @class * @namespace PIXI + * @param lineWidth {number} the width of the line to draw + * @param lineColor {number} the color of the line to draw + * @param lineAlpha {number} the alpha of the line to draw + * @param fillColor {number} the color of the fill + * @param fillAlpha {number} the alpha of the fill + * @param fill {boolean} whether or not the shape is filled with a colour + * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index f0c5ffd..9dfcaad 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -11,6 +11,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this object renderer works for. */ function GraphicsRenderer(renderer) @@ -120,7 +121,6 @@ * * @private * @param graphicsData {Graphics} The graphics object to update - * @param gl {WebGLContext} the current WebGL drawing context */ GraphicsRenderer.prototype.updateGraphics = function(graphics) { @@ -251,8 +251,8 @@ * * * @private - * @param webGL {WebGLContext} - * @param type {number} + * @param webGL {WebGLRenderingContext} the current WebGL drawing context + * @param type {number} TODO @Alvin */ GraphicsRenderer.prototype.switchMode = function (webGL, type) { @@ -286,7 +286,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRectangle = function (graphicsData, webGLData) { @@ -352,7 +352,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildRoundedRectangle = function (graphicsData, webGLData) { @@ -429,7 +429,7 @@ * @param cpY {number} Control point y * @param toX {number} Destination point x * @param toY {number} Destination point y - * @return {number[]} + * @return {number[]} an array of points */ GraphicsRenderer.prototype.quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY) { @@ -473,7 +473,7 @@ * * @private * @param graphicsData {Graphics} The graphics object to draw - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildCircle = function (graphicsData, webGLData) { @@ -554,7 +554,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildLine = function (graphicsData, webGLData) { @@ -769,7 +769,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildComplexPoly = function (graphicsData, webGLData) { @@ -831,7 +831,7 @@ * * @private * @param graphicsData {Graphics} The graphics object containing all the necessary properties - * @param webGLData {object} + * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildPoly = function (graphicsData, webGLData) { diff --git a/src/core/index.js b/src/core/index.js index 83721d5..b2893e6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -65,7 +65,7 @@ * @param [options.preserveDrawingBuffer=false] {boolean} enables drawing buffer preservation, enable this if you * need to call toDataUrl on the webgl context * @param [options.resolution=1] {number} the resolution of the renderer retina would be 2 - * @param [noWebGL=false] {Boolean} prevents selection of WebGL renderer, even if such is present + * @param [noWebGL=false] {boolean} prevents selection of WebGL renderer, even if such is present * * @return {WebGLRenderer|CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer */ diff --git a/src/core/math/Matrix.js b/src/core/math/Matrix.js index ba28c1c..e625842 100644 --- a/src/core/math/Matrix.js +++ b/src/core/math/Matrix.js @@ -1,7 +1,7 @@ var Point = require('./Point'); /** - * The Matrix class is now an object, which makes it a lot faster, + * The pixi Matrix class as an object, which makes it a lot faster, * here is a representation of it : * | a | b | tx| * | c | d | ty| @@ -271,7 +271,11 @@ return this; }; - +/** + * Inverts this matrix + * + * @return {Matrix} This matrix. Good for chaining method calls. + */ Matrix.prototype.invert = function() { var a1 = this.a; @@ -309,7 +313,11 @@ return this; }; - +/** + * Creates a new Matrix object with the same values as this one. + * + * @return {Matrix} A copy of this matrix. Good for chaining method calls. + */ Matrix.prototype.clone = function () { var matrix = new Matrix(); @@ -323,6 +331,11 @@ return matrix; }; +/** + * Changes the values of the given matrix to be the same as the ones in this matrix + * + * @return {Matrix} The matrix given in parameter with its values updated. + */ Matrix.prototype.copy = function (matrix) { matrix.a = this.a; @@ -335,6 +348,11 @@ return matrix; }; - +/** + * A default (identity) matrix + */ Matrix.IDENTITY = new Matrix(); +/** + * A temp matrix + */ Matrix.TEMP_MATRIX = new Matrix(); diff --git a/src/core/math/shapes/RoundedRectangle.js b/src/core/math/shapes/RoundedRectangle.js index 7bf6411..7ec1eb4 100644 --- a/src/core/math/shapes/RoundedRectangle.js +++ b/src/core/math/shapes/RoundedRectangle.js @@ -1,7 +1,7 @@ var CONST = require('../../const'); /** - * The Rounded Rectangle object is an area defined by its position and has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height. + * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height and its radius. * * @class * @namespace PIXI diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index e33f4f4..abc8317 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -78,7 +78,7 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} the current WebGL drawing context */ ParticleBuffer.prototype.initBuffers = function () { diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 8c48ffb..56213f0 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -78,7 +78,7 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} the current WebGL drawing context */ ParticleRenderer.prototype.onContextChange = function () { diff --git a/src/core/renderers/canvas/utils/CanvasBuffer.js b/src/core/renderers/canvas/utils/CanvasBuffer.js index ed9c248..7d06c36 100644 --- a/src/core/renderers/canvas/utils/CanvasBuffer.js +++ b/src/core/renderers/canvas/utils/CanvasBuffer.js @@ -87,6 +87,10 @@ this.canvas.height = height; }; +/** + * Destroys this canvas. + * + */ CanvasBuffer.prototype.destroy = function () { this.context = null; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index db2baee..73b785e 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -24,7 +24,7 @@ this.uuid = utils.uuid(); /** - * @member {WebGLContext} + * @member {WebGLRenderingContext} * @readonly */ this.gl = shaderManager.renderer.gl; diff --git a/src/core/renderers/webgl/utils/RenderTarget.js b/src/core/renderers/webgl/utils/RenderTarget.js index 97d7af1..c64e306 100644 --- a/src/core/renderers/webgl/utils/RenderTarget.js +++ b/src/core/renderers/webgl/utils/RenderTarget.js @@ -11,7 +11,7 @@ /** * @class FrameBuffer * @constructor -* @param gl {WebGLContext} the current WebGL drawing context +* @param gl {WebGLRenderingContext} the current WebGL drawing context * @param width {Number} the horizontal range of the filter * @param height {Number} the vertical range of the filter * @param scaleMode {Number} See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values @@ -22,7 +22,7 @@ /** * @property gl - * @type WebGLContext + * @type WebGLRenderingContext */ this.gl = gl; diff --git a/src/core/sprites/Sprite.js b/src/core/sprites/Sprite.js index 0586999..28c6e9c 100644 --- a/src/core/sprites/Sprite.js +++ b/src/core/sprites/Sprite.js @@ -26,8 +26,8 @@ /** * The anchor sets the origin point of the texture. * The default is 0,0 this means the texture's origin is the top left - * Setting than anchor to 0.5,0.5 means the textures origin is centered - * Setting the anchor to 1,1 would mean the textures origin points will be the bottom right corner + * Setting the anchor to 0.5,0.5 means the texture's origin is centered + * Setting the anchor to 1,1 would mean the texture's origin point will be the bottom right corner * * @member {Point} */ @@ -86,6 +86,12 @@ this.texture = texture || Texture.EMPTY; } +/** + * Destroys this sprite and optionally its texture + * + * @param destroyTexture {boolean} Should it destroy the current texture of the sprite as well + * @param destroyBaseTexture {boolean} Should it destroy the base texture of the sprite as well + */ Sprite.prototype.destroy = function (destroyTexture, destroyBaseTexture) { Container.prototype.destroy.call(this); @@ -199,6 +205,12 @@ } }; +/** + +* Renders the object using the WebGL renderer +* +* @param renderer {WebGLRenderer} +*/ Sprite.prototype._renderWebGL = function (renderer) { renderer.setObjectRenderer(renderer.plugins.sprite); diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index 1619596..486f010 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -164,7 +164,7 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} the current WebGL drawing context */ SpriteRenderer.prototype.onContextChange = function () {