diff --git a/inch.json b/inch.json new file mode 100644 index 0000000..9ca46c5 --- /dev/null +++ b/inch.json @@ -0,0 +1,8 @@ +{ + "files": { + // Config file for the docs badge, http://inch-ci.org/github/GoodBoyDigital/pixi.js + "excluded": [ + "src/spine/Spine.js" + ] + } +} \ No newline at end of file diff --git a/inch.json b/inch.json new file mode 100644 index 0000000..9ca46c5 --- /dev/null +++ b/inch.json @@ -0,0 +1,8 @@ +{ + "files": { + // Config file for the docs badge, http://inch-ci.org/github/GoodBoyDigital/pixi.js + "excluded": [ + "src/spine/Spine.js" + ] + } +} \ No newline at end of file diff --git a/src/core/index.js b/src/core/index.js index 21c817a..b67c15a 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -86,6 +86,10 @@ { window.console.warn("You don't need to use a PIXI Stage any more, you can simply render any container"); return new core.Container(); + }, + + SpriteBatch: function () { + window.console.warn("SpriteBatch doesn't exist any more, please use the new ParticleContainer instead"); } }; diff --git a/inch.json b/inch.json new file mode 100644 index 0000000..9ca46c5 --- /dev/null +++ b/inch.json @@ -0,0 +1,8 @@ +{ + "files": { + // Config file for the docs badge, http://inch-ci.org/github/GoodBoyDigital/pixi.js + "excluded": [ + "src/spine/Spine.js" + ] + } +} \ No newline at end of file diff --git a/src/core/index.js b/src/core/index.js index 21c817a..b67c15a 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -86,6 +86,10 @@ { window.console.warn("You don't need to use a PIXI Stage any more, you can simply render any container"); return new core.Container(); + }, + + SpriteBatch: function () { + window.console.warn("SpriteBatch doesn't exist any more, please use the new ParticleContainer instead"); } }; diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 5d52916..823fc78 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -25,6 +25,7 @@ * @memberof PIXI * * @param size {number} The number of images in the SpriteBatch before it flushes. + * @param properties {object} The properties to be uploaded */ function ParticleContainer(size, properties) { @@ -32,11 +33,41 @@ // set properties to be dynamic (true) / static (false) // TODO this could be easier to understand! + /* this._properties = { + scale : false, + position : true, + rotation : false, + uvs : false, + alpha : false + * } + */ + /** + * @member {object} + * @private + */ this._properties = properties || [false, true, false, false, false]; + /** + * @member {number} + * @private + */ this._size = size || 15000; + + /** + * @member {WebGLBuffer} + * @private + */ this._buffers = null; + + /** + * @member {boolean} + * @private + */ this._updateStatic = false; + /** + * @member {boolean} + * + */ this.interactiveChildren = false; } diff --git a/inch.json b/inch.json new file mode 100644 index 0000000..9ca46c5 --- /dev/null +++ b/inch.json @@ -0,0 +1,8 @@ +{ + "files": { + // Config file for the docs badge, http://inch-ci.org/github/GoodBoyDigital/pixi.js + "excluded": [ + "src/spine/Spine.js" + ] + } +} \ No newline at end of file diff --git a/src/core/index.js b/src/core/index.js index 21c817a..b67c15a 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -86,6 +86,10 @@ { window.console.warn("You don't need to use a PIXI Stage any more, you can simply render any container"); return new core.Container(); + }, + + SpriteBatch: function () { + window.console.warn("SpriteBatch doesn't exist any more, please use the new ParticleContainer instead"); } }; diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 5d52916..823fc78 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -25,6 +25,7 @@ * @memberof PIXI * * @param size {number} The number of images in the SpriteBatch before it flushes. + * @param properties {object} The properties to be uploaded */ function ParticleContainer(size, properties) { @@ -32,11 +33,41 @@ // set properties to be dynamic (true) / static (false) // TODO this could be easier to understand! + /* this._properties = { + scale : false, + position : true, + rotation : false, + uvs : false, + alpha : false + * } + */ + /** + * @member {object} + * @private + */ this._properties = properties || [false, true, false, false, false]; + /** + * @member {number} + * @private + */ this._size = size || 15000; + + /** + * @member {WebGLBuffer} + * @private + */ this._buffers = null; + + /** + * @member {boolean} + * @private + */ this._updateStatic = false; + /** + * @member {boolean} + * + */ this.interactiveChildren = false; } diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index cf40b2f..8b78bc4 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -97,7 +97,7 @@ this.properties = [ - //verticiesData + //verticesData { attribute:this.shader.attributes.aVertexPosition, dynamic:false, diff --git a/inch.json b/inch.json new file mode 100644 index 0000000..9ca46c5 --- /dev/null +++ b/inch.json @@ -0,0 +1,8 @@ +{ + "files": { + // Config file for the docs badge, http://inch-ci.org/github/GoodBoyDigital/pixi.js + "excluded": [ + "src/spine/Spine.js" + ] + } +} \ No newline at end of file diff --git a/src/core/index.js b/src/core/index.js index 21c817a..b67c15a 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -86,6 +86,10 @@ { window.console.warn("You don't need to use a PIXI Stage any more, you can simply render any container"); return new core.Container(); + }, + + SpriteBatch: function () { + window.console.warn("SpriteBatch doesn't exist any more, please use the new ParticleContainer instead"); } }; diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 5d52916..823fc78 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -25,6 +25,7 @@ * @memberof PIXI * * @param size {number} The number of images in the SpriteBatch before it flushes. + * @param properties {object} The properties to be uploaded */ function ParticleContainer(size, properties) { @@ -32,11 +33,41 @@ // set properties to be dynamic (true) / static (false) // TODO this could be easier to understand! + /* this._properties = { + scale : false, + position : true, + rotation : false, + uvs : false, + alpha : false + * } + */ + /** + * @member {object} + * @private + */ this._properties = properties || [false, true, false, false, false]; + /** + * @member {number} + * @private + */ this._size = size || 15000; + + /** + * @member {WebGLBuffer} + * @private + */ this._buffers = null; + + /** + * @member {boolean} + * @private + */ this._updateStatic = false; + /** + * @member {boolean} + * + */ this.interactiveChildren = false; } diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index cf40b2f..8b78bc4 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -97,7 +97,7 @@ this.properties = [ - //verticiesData + //verticesData { attribute:this.shader.attributes.aVertexPosition, dynamic:false, diff --git a/src/core/renderers/webgl/utils/StencilMaskStack.js b/src/core/renderers/webgl/utils/StencilMaskStack.js index d7a78ff..4be85f1 100644 --- a/src/core/renderers/webgl/utils/StencilMaskStack.js +++ b/src/core/renderers/webgl/utils/StencilMaskStack.js @@ -6,8 +6,25 @@ */ function StencilMaskStack() { + /** + * The actual stack + * + * @member {Array} + */ this.stencilStack = []; + + /** + * TODO @alvin + * + * @member {boolean} + */ this.reverse = true; + + /** + * Internal count + * + * @member {number} + */ this.count = 0; } diff --git a/inch.json b/inch.json new file mode 100644 index 0000000..9ca46c5 --- /dev/null +++ b/inch.json @@ -0,0 +1,8 @@ +{ + "files": { + // Config file for the docs badge, http://inch-ci.org/github/GoodBoyDigital/pixi.js + "excluded": [ + "src/spine/Spine.js" + ] + } +} \ No newline at end of file diff --git a/src/core/index.js b/src/core/index.js index 21c817a..b67c15a 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -86,6 +86,10 @@ { window.console.warn("You don't need to use a PIXI Stage any more, you can simply render any container"); return new core.Container(); + }, + + SpriteBatch: function () { + window.console.warn("SpriteBatch doesn't exist any more, please use the new ParticleContainer instead"); } }; diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 5d52916..823fc78 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -25,6 +25,7 @@ * @memberof PIXI * * @param size {number} The number of images in the SpriteBatch before it flushes. + * @param properties {object} The properties to be uploaded */ function ParticleContainer(size, properties) { @@ -32,11 +33,41 @@ // set properties to be dynamic (true) / static (false) // TODO this could be easier to understand! + /* this._properties = { + scale : false, + position : true, + rotation : false, + uvs : false, + alpha : false + * } + */ + /** + * @member {object} + * @private + */ this._properties = properties || [false, true, false, false, false]; + /** + * @member {number} + * @private + */ this._size = size || 15000; + + /** + * @member {WebGLBuffer} + * @private + */ this._buffers = null; + + /** + * @member {boolean} + * @private + */ this._updateStatic = false; + /** + * @member {boolean} + * + */ this.interactiveChildren = false; } diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index cf40b2f..8b78bc4 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -97,7 +97,7 @@ this.properties = [ - //verticiesData + //verticesData { attribute:this.shader.attributes.aVertexPosition, dynamic:false, diff --git a/src/core/renderers/webgl/utils/StencilMaskStack.js b/src/core/renderers/webgl/utils/StencilMaskStack.js index d7a78ff..4be85f1 100644 --- a/src/core/renderers/webgl/utils/StencilMaskStack.js +++ b/src/core/renderers/webgl/utils/StencilMaskStack.js @@ -6,8 +6,25 @@ */ function StencilMaskStack() { + /** + * The actual stack + * + * @member {Array} + */ this.stencilStack = []; + + /** + * TODO @alvin + * + * @member {boolean} + */ this.reverse = true; + + /** + * Internal count + * + * @member {number} + */ this.count = 0; } diff --git a/src/core/sprites/Sprite.js b/src/core/sprites/Sprite.js index fa4fff6..e3c6b54 100644 --- a/src/core/sprites/Sprite.js +++ b/src/core/sprites/Sprite.js @@ -524,6 +524,8 @@ * @static * @param frameId {String} The frame Id of the texture in the cache * @return {Sprite} A new Sprite using a texture from the texture cache matching the frameId + * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter + * @param [scaleMode=scaleModes.DEFAULT] {number} if you want to specify the scale mode, see {@link SCALE_MODES} for possible values */ Sprite.fromFrame = function (frameId) { @@ -531,7 +533,7 @@ if (!texture) { - throw new Error('The frameId "' + frameId + '" does not exist in the texture cache' + this); + throw new Error('The frameId "' + frameId + '" does not exist in the texture cache ' + this); } return new Sprite(texture); diff --git a/inch.json b/inch.json new file mode 100644 index 0000000..9ca46c5 --- /dev/null +++ b/inch.json @@ -0,0 +1,8 @@ +{ + "files": { + // Config file for the docs badge, http://inch-ci.org/github/GoodBoyDigital/pixi.js + "excluded": [ + "src/spine/Spine.js" + ] + } +} \ No newline at end of file diff --git a/src/core/index.js b/src/core/index.js index 21c817a..b67c15a 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -86,6 +86,10 @@ { window.console.warn("You don't need to use a PIXI Stage any more, you can simply render any container"); return new core.Container(); + }, + + SpriteBatch: function () { + window.console.warn("SpriteBatch doesn't exist any more, please use the new ParticleContainer instead"); } }; diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 5d52916..823fc78 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -25,6 +25,7 @@ * @memberof PIXI * * @param size {number} The number of images in the SpriteBatch before it flushes. + * @param properties {object} The properties to be uploaded */ function ParticleContainer(size, properties) { @@ -32,11 +33,41 @@ // set properties to be dynamic (true) / static (false) // TODO this could be easier to understand! + /* this._properties = { + scale : false, + position : true, + rotation : false, + uvs : false, + alpha : false + * } + */ + /** + * @member {object} + * @private + */ this._properties = properties || [false, true, false, false, false]; + /** + * @member {number} + * @private + */ this._size = size || 15000; + + /** + * @member {WebGLBuffer} + * @private + */ this._buffers = null; + + /** + * @member {boolean} + * @private + */ this._updateStatic = false; + /** + * @member {boolean} + * + */ this.interactiveChildren = false; } diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index cf40b2f..8b78bc4 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -97,7 +97,7 @@ this.properties = [ - //verticiesData + //verticesData { attribute:this.shader.attributes.aVertexPosition, dynamic:false, diff --git a/src/core/renderers/webgl/utils/StencilMaskStack.js b/src/core/renderers/webgl/utils/StencilMaskStack.js index d7a78ff..4be85f1 100644 --- a/src/core/renderers/webgl/utils/StencilMaskStack.js +++ b/src/core/renderers/webgl/utils/StencilMaskStack.js @@ -6,8 +6,25 @@ */ function StencilMaskStack() { + /** + * The actual stack + * + * @member {Array} + */ this.stencilStack = []; + + /** + * TODO @alvin + * + * @member {boolean} + */ this.reverse = true; + + /** + * Internal count + * + * @member {number} + */ this.count = 0; } diff --git a/src/core/sprites/Sprite.js b/src/core/sprites/Sprite.js index fa4fff6..e3c6b54 100644 --- a/src/core/sprites/Sprite.js +++ b/src/core/sprites/Sprite.js @@ -524,6 +524,8 @@ * @static * @param frameId {String} The frame Id of the texture in the cache * @return {Sprite} A new Sprite using a texture from the texture cache matching the frameId + * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter + * @param [scaleMode=scaleModes.DEFAULT] {number} if you want to specify the scale mode, see {@link SCALE_MODES} for possible values */ Sprite.fromFrame = function (frameId) { @@ -531,7 +533,7 @@ if (!texture) { - throw new Error('The frameId "' + frameId + '" does not exist in the texture cache' + this); + throw new Error('The frameId "' + frameId + '" does not exist in the texture cache ' + this); } return new Sprite(texture); diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 4d4d9ab..312a772 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -363,7 +363,7 @@ * * @static * @param imageUrl {string} The image url of the texture - * @param [crossorigin=(auto)] {boolean} Should use anonymouse CORS? Defaults to true if the URL is not a data-URI. + * @param [crossorigin=(auto)] {boolean} Should use anonymous CORS? Defaults to true if the URL is not a data-URI. * @param [scaleMode=scaleModes.DEFAULT] {number} See {@link SCALE_MODES} for possible values * @return BaseTexture */ diff --git a/inch.json b/inch.json new file mode 100644 index 0000000..9ca46c5 --- /dev/null +++ b/inch.json @@ -0,0 +1,8 @@ +{ + "files": { + // Config file for the docs badge, http://inch-ci.org/github/GoodBoyDigital/pixi.js + "excluded": [ + "src/spine/Spine.js" + ] + } +} \ No newline at end of file diff --git a/src/core/index.js b/src/core/index.js index 21c817a..b67c15a 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -86,6 +86,10 @@ { window.console.warn("You don't need to use a PIXI Stage any more, you can simply render any container"); return new core.Container(); + }, + + SpriteBatch: function () { + window.console.warn("SpriteBatch doesn't exist any more, please use the new ParticleContainer instead"); } }; diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 5d52916..823fc78 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -25,6 +25,7 @@ * @memberof PIXI * * @param size {number} The number of images in the SpriteBatch before it flushes. + * @param properties {object} The properties to be uploaded */ function ParticleContainer(size, properties) { @@ -32,11 +33,41 @@ // set properties to be dynamic (true) / static (false) // TODO this could be easier to understand! + /* this._properties = { + scale : false, + position : true, + rotation : false, + uvs : false, + alpha : false + * } + */ + /** + * @member {object} + * @private + */ this._properties = properties || [false, true, false, false, false]; + /** + * @member {number} + * @private + */ this._size = size || 15000; + + /** + * @member {WebGLBuffer} + * @private + */ this._buffers = null; + + /** + * @member {boolean} + * @private + */ this._updateStatic = false; + /** + * @member {boolean} + * + */ this.interactiveChildren = false; } diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index cf40b2f..8b78bc4 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -97,7 +97,7 @@ this.properties = [ - //verticiesData + //verticesData { attribute:this.shader.attributes.aVertexPosition, dynamic:false, diff --git a/src/core/renderers/webgl/utils/StencilMaskStack.js b/src/core/renderers/webgl/utils/StencilMaskStack.js index d7a78ff..4be85f1 100644 --- a/src/core/renderers/webgl/utils/StencilMaskStack.js +++ b/src/core/renderers/webgl/utils/StencilMaskStack.js @@ -6,8 +6,25 @@ */ function StencilMaskStack() { + /** + * The actual stack + * + * @member {Array} + */ this.stencilStack = []; + + /** + * TODO @alvin + * + * @member {boolean} + */ this.reverse = true; + + /** + * Internal count + * + * @member {number} + */ this.count = 0; } diff --git a/src/core/sprites/Sprite.js b/src/core/sprites/Sprite.js index fa4fff6..e3c6b54 100644 --- a/src/core/sprites/Sprite.js +++ b/src/core/sprites/Sprite.js @@ -524,6 +524,8 @@ * @static * @param frameId {String} The frame Id of the texture in the cache * @return {Sprite} A new Sprite using a texture from the texture cache matching the frameId + * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter + * @param [scaleMode=scaleModes.DEFAULT] {number} if you want to specify the scale mode, see {@link SCALE_MODES} for possible values */ Sprite.fromFrame = function (frameId) { @@ -531,7 +533,7 @@ if (!texture) { - throw new Error('The frameId "' + frameId + '" does not exist in the texture cache' + this); + throw new Error('The frameId "' + frameId + '" does not exist in the texture cache ' + this); } return new Sprite(texture); diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 4d4d9ab..312a772 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -363,7 +363,7 @@ * * @static * @param imageUrl {string} The image url of the texture - * @param [crossorigin=(auto)] {boolean} Should use anonymouse CORS? Defaults to true if the URL is not a data-URI. + * @param [crossorigin=(auto)] {boolean} Should use anonymous CORS? Defaults to true if the URL is not a data-URI. * @param [scaleMode=scaleModes.DEFAULT] {number} See {@link SCALE_MODES} for possible values * @return BaseTexture */ diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 4efc453..3e6878a 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -159,6 +159,7 @@ return; } + var uvs = this._uvs; this.tilePosition.x %= texture.baseTexture.width / this._tileScaleOffset.x; @@ -487,3 +488,42 @@ this._uvs = null; }; + +/** + * Helper function that creates a tiling sprite that will use a texture from the TextureCache based on the frameId + * The frame ids are created when a Texture packer file has been loaded + * + * @static + * @param frameId {String} The frame Id of the texture in the cache + * @return {TilingSprite} A new TilingSprite using a texture from the texture cache matching the frameId + * @param width {number} the width of the tiling sprite + * @param height {number} the height of the tiling sprite + */ +TilingSprite.fromFrame = function (frameId,width,height) +{ + var texture = utils.TextureCache[frameId]; + + if (!texture) + { + throw new Error('The frameId "' + frameId + '" does not exist in the texture cache ' + this); + } + + return new TilingSprite(texture,width,height); +}; + +/** + * Helper function that creates a sprite that will contain a texture based on an image url + * If the image is not in the texture cache it will be loaded + * + * @static + * @param imageId {String} The image url of the texture + * @param width {number} the width of the tiling sprite + * @param height {number} the height of the tiling sprite + * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter + * @param [scaleMode=scaleModes.DEFAULT] {number} if you want to specify the scale mode, see {@link SCALE_MODES} for possible values + * @return {TilingSprite} A new TilingSprite using a texture from the texture cache matching the image id + */ +TilingSprite.fromImage = function (imageId, width, height, crossorigin, scaleMode) +{ + return new TilingSprite(Texture.fromImage(imageId, crossorigin, scaleMode),width,height); +}; diff --git a/inch.json b/inch.json new file mode 100644 index 0000000..9ca46c5 --- /dev/null +++ b/inch.json @@ -0,0 +1,8 @@ +{ + "files": { + // Config file for the docs badge, http://inch-ci.org/github/GoodBoyDigital/pixi.js + "excluded": [ + "src/spine/Spine.js" + ] + } +} \ No newline at end of file diff --git a/src/core/index.js b/src/core/index.js index 21c817a..b67c15a 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -86,6 +86,10 @@ { window.console.warn("You don't need to use a PIXI Stage any more, you can simply render any container"); return new core.Container(); + }, + + SpriteBatch: function () { + window.console.warn("SpriteBatch doesn't exist any more, please use the new ParticleContainer instead"); } }; diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 5d52916..823fc78 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -25,6 +25,7 @@ * @memberof PIXI * * @param size {number} The number of images in the SpriteBatch before it flushes. + * @param properties {object} The properties to be uploaded */ function ParticleContainer(size, properties) { @@ -32,11 +33,41 @@ // set properties to be dynamic (true) / static (false) // TODO this could be easier to understand! + /* this._properties = { + scale : false, + position : true, + rotation : false, + uvs : false, + alpha : false + * } + */ + /** + * @member {object} + * @private + */ this._properties = properties || [false, true, false, false, false]; + /** + * @member {number} + * @private + */ this._size = size || 15000; + + /** + * @member {WebGLBuffer} + * @private + */ this._buffers = null; + + /** + * @member {boolean} + * @private + */ this._updateStatic = false; + /** + * @member {boolean} + * + */ this.interactiveChildren = false; } diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index cf40b2f..8b78bc4 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -97,7 +97,7 @@ this.properties = [ - //verticiesData + //verticesData { attribute:this.shader.attributes.aVertexPosition, dynamic:false, diff --git a/src/core/renderers/webgl/utils/StencilMaskStack.js b/src/core/renderers/webgl/utils/StencilMaskStack.js index d7a78ff..4be85f1 100644 --- a/src/core/renderers/webgl/utils/StencilMaskStack.js +++ b/src/core/renderers/webgl/utils/StencilMaskStack.js @@ -6,8 +6,25 @@ */ function StencilMaskStack() { + /** + * The actual stack + * + * @member {Array} + */ this.stencilStack = []; + + /** + * TODO @alvin + * + * @member {boolean} + */ this.reverse = true; + + /** + * Internal count + * + * @member {number} + */ this.count = 0; } diff --git a/src/core/sprites/Sprite.js b/src/core/sprites/Sprite.js index fa4fff6..e3c6b54 100644 --- a/src/core/sprites/Sprite.js +++ b/src/core/sprites/Sprite.js @@ -524,6 +524,8 @@ * @static * @param frameId {String} The frame Id of the texture in the cache * @return {Sprite} A new Sprite using a texture from the texture cache matching the frameId + * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter + * @param [scaleMode=scaleModes.DEFAULT] {number} if you want to specify the scale mode, see {@link SCALE_MODES} for possible values */ Sprite.fromFrame = function (frameId) { @@ -531,7 +533,7 @@ if (!texture) { - throw new Error('The frameId "' + frameId + '" does not exist in the texture cache' + this); + throw new Error('The frameId "' + frameId + '" does not exist in the texture cache ' + this); } return new Sprite(texture); diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 4d4d9ab..312a772 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -363,7 +363,7 @@ * * @static * @param imageUrl {string} The image url of the texture - * @param [crossorigin=(auto)] {boolean} Should use anonymouse CORS? Defaults to true if the URL is not a data-URI. + * @param [crossorigin=(auto)] {boolean} Should use anonymous CORS? Defaults to true if the URL is not a data-URI. * @param [scaleMode=scaleModes.DEFAULT] {number} See {@link SCALE_MODES} for possible values * @return BaseTexture */ diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 4efc453..3e6878a 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -159,6 +159,7 @@ return; } + var uvs = this._uvs; this.tilePosition.x %= texture.baseTexture.width / this._tileScaleOffset.x; @@ -487,3 +488,42 @@ this._uvs = null; }; + +/** + * Helper function that creates a tiling sprite that will use a texture from the TextureCache based on the frameId + * The frame ids are created when a Texture packer file has been loaded + * + * @static + * @param frameId {String} The frame Id of the texture in the cache + * @return {TilingSprite} A new TilingSprite using a texture from the texture cache matching the frameId + * @param width {number} the width of the tiling sprite + * @param height {number} the height of the tiling sprite + */ +TilingSprite.fromFrame = function (frameId,width,height) +{ + var texture = utils.TextureCache[frameId]; + + if (!texture) + { + throw new Error('The frameId "' + frameId + '" does not exist in the texture cache ' + this); + } + + return new TilingSprite(texture,width,height); +}; + +/** + * Helper function that creates a sprite that will contain a texture based on an image url + * If the image is not in the texture cache it will be loaded + * + * @static + * @param imageId {String} The image url of the texture + * @param width {number} the width of the tiling sprite + * @param height {number} the height of the tiling sprite + * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter + * @param [scaleMode=scaleModes.DEFAULT] {number} if you want to specify the scale mode, see {@link SCALE_MODES} for possible values + * @return {TilingSprite} A new TilingSprite using a texture from the texture cache matching the image id + */ +TilingSprite.fromImage = function (imageId, width, height, crossorigin, scaleMode) +{ + return new TilingSprite(Texture.fromImage(imageId, crossorigin, scaleMode),width,height); +}; diff --git a/src/loaders/spineAtlasParser.js b/src/loaders/spineAtlasParser.js index ec0f60d..2a42091 100644 --- a/src/loaders/spineAtlasParser.js +++ b/src/loaders/spineAtlasParser.js @@ -19,17 +19,19 @@ crossOrigin: resource.crossOrigin, xhrType: Resource.XHR_RESPONSE_TYPE.TEXT }; + var baseUrl = resource.url.substr(0, resource.url.lastIndexOf('/') + 1); + this.add(resource.name + '_atlas', atlasPath, atlasOptions, function (res) { // create a spine atlas using the loaded text - var spineAtlas = new spine.Atlas(this.ajaxRequest.responseText, this.baseUrl, res.crossOrigin); + var spineAtlas = new spine.SpineRuntime.Atlas(this.xhr.responseText, baseUrl, res.crossOrigin); // spine animation - var spineJsonParser = new spine.SkeletonJsonParser(new spine.AtlasAttachmentParser(spineAtlas)); + var spineJsonParser = new spine.SpineRuntime.SkeletonJsonParser(new spine.SpineRuntime.AtlasAttachmentParser(spineAtlas)); var skeletonData = spineJsonParser.readSkeletonData(resource.data); - resource.spine = skeletonData; + resource.spineData = skeletonData; resource.spineAtlas = spineAtlas; // Go through each spineAtlas.pages and wait for page.rendererObject (a baseTexture) to diff --git a/inch.json b/inch.json new file mode 100644 index 0000000..9ca46c5 --- /dev/null +++ b/inch.json @@ -0,0 +1,8 @@ +{ + "files": { + // Config file for the docs badge, http://inch-ci.org/github/GoodBoyDigital/pixi.js + "excluded": [ + "src/spine/Spine.js" + ] + } +} \ No newline at end of file diff --git a/src/core/index.js b/src/core/index.js index 21c817a..b67c15a 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -86,6 +86,10 @@ { window.console.warn("You don't need to use a PIXI Stage any more, you can simply render any container"); return new core.Container(); + }, + + SpriteBatch: function () { + window.console.warn("SpriteBatch doesn't exist any more, please use the new ParticleContainer instead"); } }; diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 5d52916..823fc78 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -25,6 +25,7 @@ * @memberof PIXI * * @param size {number} The number of images in the SpriteBatch before it flushes. + * @param properties {object} The properties to be uploaded */ function ParticleContainer(size, properties) { @@ -32,11 +33,41 @@ // set properties to be dynamic (true) / static (false) // TODO this could be easier to understand! + /* this._properties = { + scale : false, + position : true, + rotation : false, + uvs : false, + alpha : false + * } + */ + /** + * @member {object} + * @private + */ this._properties = properties || [false, true, false, false, false]; + /** + * @member {number} + * @private + */ this._size = size || 15000; + + /** + * @member {WebGLBuffer} + * @private + */ this._buffers = null; + + /** + * @member {boolean} + * @private + */ this._updateStatic = false; + /** + * @member {boolean} + * + */ this.interactiveChildren = false; } diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index cf40b2f..8b78bc4 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -97,7 +97,7 @@ this.properties = [ - //verticiesData + //verticesData { attribute:this.shader.attributes.aVertexPosition, dynamic:false, diff --git a/src/core/renderers/webgl/utils/StencilMaskStack.js b/src/core/renderers/webgl/utils/StencilMaskStack.js index d7a78ff..4be85f1 100644 --- a/src/core/renderers/webgl/utils/StencilMaskStack.js +++ b/src/core/renderers/webgl/utils/StencilMaskStack.js @@ -6,8 +6,25 @@ */ function StencilMaskStack() { + /** + * The actual stack + * + * @member {Array} + */ this.stencilStack = []; + + /** + * TODO @alvin + * + * @member {boolean} + */ this.reverse = true; + + /** + * Internal count + * + * @member {number} + */ this.count = 0; } diff --git a/src/core/sprites/Sprite.js b/src/core/sprites/Sprite.js index fa4fff6..e3c6b54 100644 --- a/src/core/sprites/Sprite.js +++ b/src/core/sprites/Sprite.js @@ -524,6 +524,8 @@ * @static * @param frameId {String} The frame Id of the texture in the cache * @return {Sprite} A new Sprite using a texture from the texture cache matching the frameId + * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter + * @param [scaleMode=scaleModes.DEFAULT] {number} if you want to specify the scale mode, see {@link SCALE_MODES} for possible values */ Sprite.fromFrame = function (frameId) { @@ -531,7 +533,7 @@ if (!texture) { - throw new Error('The frameId "' + frameId + '" does not exist in the texture cache' + this); + throw new Error('The frameId "' + frameId + '" does not exist in the texture cache ' + this); } return new Sprite(texture); diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 4d4d9ab..312a772 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -363,7 +363,7 @@ * * @static * @param imageUrl {string} The image url of the texture - * @param [crossorigin=(auto)] {boolean} Should use anonymouse CORS? Defaults to true if the URL is not a data-URI. + * @param [crossorigin=(auto)] {boolean} Should use anonymous CORS? Defaults to true if the URL is not a data-URI. * @param [scaleMode=scaleModes.DEFAULT] {number} See {@link SCALE_MODES} for possible values * @return BaseTexture */ diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 4efc453..3e6878a 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -159,6 +159,7 @@ return; } + var uvs = this._uvs; this.tilePosition.x %= texture.baseTexture.width / this._tileScaleOffset.x; @@ -487,3 +488,42 @@ this._uvs = null; }; + +/** + * Helper function that creates a tiling sprite that will use a texture from the TextureCache based on the frameId + * The frame ids are created when a Texture packer file has been loaded + * + * @static + * @param frameId {String} The frame Id of the texture in the cache + * @return {TilingSprite} A new TilingSprite using a texture from the texture cache matching the frameId + * @param width {number} the width of the tiling sprite + * @param height {number} the height of the tiling sprite + */ +TilingSprite.fromFrame = function (frameId,width,height) +{ + var texture = utils.TextureCache[frameId]; + + if (!texture) + { + throw new Error('The frameId "' + frameId + '" does not exist in the texture cache ' + this); + } + + return new TilingSprite(texture,width,height); +}; + +/** + * Helper function that creates a sprite that will contain a texture based on an image url + * If the image is not in the texture cache it will be loaded + * + * @static + * @param imageId {String} The image url of the texture + * @param width {number} the width of the tiling sprite + * @param height {number} the height of the tiling sprite + * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter + * @param [scaleMode=scaleModes.DEFAULT] {number} if you want to specify the scale mode, see {@link SCALE_MODES} for possible values + * @return {TilingSprite} A new TilingSprite using a texture from the texture cache matching the image id + */ +TilingSprite.fromImage = function (imageId, width, height, crossorigin, scaleMode) +{ + return new TilingSprite(Texture.fromImage(imageId, crossorigin, scaleMode),width,height); +}; diff --git a/src/loaders/spineAtlasParser.js b/src/loaders/spineAtlasParser.js index ec0f60d..2a42091 100644 --- a/src/loaders/spineAtlasParser.js +++ b/src/loaders/spineAtlasParser.js @@ -19,17 +19,19 @@ crossOrigin: resource.crossOrigin, xhrType: Resource.XHR_RESPONSE_TYPE.TEXT }; + var baseUrl = resource.url.substr(0, resource.url.lastIndexOf('/') + 1); + this.add(resource.name + '_atlas', atlasPath, atlasOptions, function (res) { // create a spine atlas using the loaded text - var spineAtlas = new spine.Atlas(this.ajaxRequest.responseText, this.baseUrl, res.crossOrigin); + var spineAtlas = new spine.SpineRuntime.Atlas(this.xhr.responseText, baseUrl, res.crossOrigin); // spine animation - var spineJsonParser = new spine.SkeletonJsonParser(new spine.AtlasAttachmentParser(spineAtlas)); + var spineJsonParser = new spine.SpineRuntime.SkeletonJsonParser(new spine.SpineRuntime.AtlasAttachmentParser(spineAtlas)); var skeletonData = spineJsonParser.readSkeletonData(resource.data); - resource.spine = skeletonData; + resource.spineData = skeletonData; resource.spineAtlas = spineAtlas; // Go through each spineAtlas.pages and wait for page.rendererObject (a baseTexture) to diff --git a/src/spine/index.js b/src/spine/index.js index 838d6aa..f48c6c6 100644 --- a/src/spine/index.js +++ b/src/spine/index.js @@ -10,5 +10,5 @@ */ module.exports = { Spine: require('./Spine'), - runtime: require('./SpineRuntime') + SpineRuntime: require('./SpineRuntime') };