502502 </ ul >
503503 </ li >
504504
505-
505+ </ strong >
506506 </ ul >
507507 </ div >
508508 </ div >
@@ -581,7 +581,7 @@ <h1 class="page-title">Source: animation/AnimationParser.js</h1>
581581 // Zero or smaller than frame sizes?
582582 if (width === 0 || height === 0 || width < frameWidth || height < frameHeight || total === 0)
583583 {
584- console.warn("Phaser.AnimationParser.spriteSheet: width/height zero or width/height < given frameWidth/frameHeight");
584+ console.warn("Phaser.AnimationParser.spriteSheet: '" + key + "'s width/height zero or width/height < given frameWidth/frameHeight");
585585 return null;
586586 }
587587
@@ -597,6 +597,13 @@ <h1 class="page-title">Source: animation/AnimationParser.js</h1>
597597 // uuid needed?
598598 data.addFrame(new Phaser.Frame(i, x, y, frameWidth, frameHeight, '', uuid));
599599
600+ PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[key], {
601+ x: x,
602+ y: y,
603+ width: frameWidth,
604+ height: frameHeight
605+ });
606+
600607 x += frameWidth + spacing;
601608
602609 if (x + frameWidth > width)
@@ -616,9 +623,10 @@ <h1 class="page-title">Source: animation/AnimationParser.js</h1>
616623 * @method Phaser.AnimationParser.JSONData
617624 * @param {Phaser.Game} game - A reference to the currently running game.
618625 * @param {Object} json - The JSON data from the Texture Atlas. Must be in Array format.
626+ * @param {string} cacheKey - The Game.Cache asset key of the texture image.
619627 * @return {Phaser.FrameData} A FrameData object containing the parsed frames.
620628 */
621- JSONData: function (game, json) {
629+ JSONData: function (game, json, cacheKey ) {
622630
623631 // Malformed?
624632 if (!json['frames'])
@@ -649,6 +657,13 @@ <h1 class="page-title">Source: animation/AnimationParser.js</h1>
649657 uuid
650658 ));
651659
660+ PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[cacheKey], {
661+ x: frames[i].frame.x,
662+ y: frames[i].frame.y,
663+ width: frames[i].frame.w,
664+ height: frames[i].frame.h
665+ });
666+
652667 if (frames[i].trimmed)
653668 {
654669 newFrame.setTrim(
@@ -673,9 +688,10 @@ <h1 class="page-title">Source: animation/AnimationParser.js</h1>
673688 * @method Phaser.AnimationParser.JSONDataHash
674689 * @param {Phaser.Game} game - A reference to the currently running game.
675690 * @param {Object} json - The JSON data from the Texture Atlas. Must be in JSON Hash format.
691+ * @param {string} cacheKey - The Game.Cache asset key of the texture image.
676692 * @return {Phaser.FrameData} A FrameData object containing the parsed frames.
677693 */
678- JSONDataHash: function (game, json) {
694+ JSONDataHash: function (game, json, cacheKey ) {
679695
680696 // Malformed?
681697 if (!json['frames'])
@@ -707,6 +723,13 @@ <h1 class="page-title">Source: animation/AnimationParser.js</h1>
707723 uuid
708724 ));
709725
726+ PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[cacheKey], {
727+ x: frames[key].frame.x,
728+ y: frames[key].frame.y,
729+ width: frames[key].frame.w,
730+ height: frames[key].frame.h
731+ });
732+
710733 if (frames[key].trimmed)
711734 {
712735 newFrame.setTrim(
@@ -733,9 +756,10 @@ <h1 class="page-title">Source: animation/AnimationParser.js</h1>
733756 * @method Phaser.AnimationParser.XMLData
734757 * @param {Phaser.Game} game - A reference to the currently running game.
735758 * @param {Object} xml - The XML data from the Texture Atlas. Must be in Starling XML format.
759+ * @param {string} cacheKey - The Game.Cache asset key of the texture image.
736760 * @return {Phaser.FrameData} A FrameData object containing the parsed frames.
737761 */
738- XMLData: function (game, xml) {
762+ XMLData: function (game, xml, cacheKey ) {
739763
740764 // Malformed?
741765 if (!xml.getElementsByTagName('TextureAtlas'))
@@ -786,7 +810,13 @@ <h1 class="page-title">Source: animation/AnimationParser.js</h1>
786810
787811 newFrame = data.addFrame(new Phaser.Frame(i, x, y, width, height, name, uuid));
788812
789- // Trimmed?
813+ PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[cacheKey], {
814+ x: x,
815+ y: y,
816+ width: width,
817+ height: height
818+ });
819+ // Trimmed?
790820 if (frameX !== null || frameY !== null)
791821 {
792822 newFrame.setTrim(true, width, height, frameX, frameY, frameWidth, frameHeight);
@@ -819,7 +849,7 @@ <h1 class="page-title">Source: animation/AnimationParser.js</h1>
819849
820850 < span class ="jsdoc-message ">
821851 Documentation generated by < a href ="https://github.com/jsdoc3/jsdoc "> JSDoc 3.3.0-dev</ a >
822- on Thu Jul 10 2014 20:18:55 GMT+0100 (BST) using the < a href ="https://github.com/terryweiss/docstrap "> DocStrap template</ a > .
852+ on Fri Jul 18 2014 12:36:36 GMT+0100 (BST) using the < a href ="https://github.com/terryweiss/docstrap "> DocStrap template</ a > .
823853 </ span >
824854 </ footer >
825855 </ div >
0 commit comments