diff --git a/examples/assets/sprites/atlas json array trimmed.tps b/examples/assets/sprites/atlas json array trimmed.tps index df5a2a99..f6b6eb2a 100644 --- a/examples/assets/sprites/atlas json array trimmed.tps +++ b/examples/assets/sprites/atlas json array trimmed.tps @@ -2,17 +2,31 @@ fileFormatVersion - 1 - variation - main - verbose - + 3 + texturePackerVersion + 3.2.1 autoSDSettings - + + + scale + 1 + extension + + spriteFilter + + acceptFractionalValues + + maxTextureSize + + width + -1 + height + -1 + + + allowRotation - quiet - premultiplyAlpha shapeDebug @@ -20,9 +34,9 @@ dpi 72 dataFormat - json-array + json textureFileName - atlas_json_array_trimmed.png + atlas_hash_trim.png flipPVR ditherType @@ -74,7 +88,7 @@ freeSizeMode Best sizeConstraints - POT + AnySize forceSquared forceWordAligned @@ -98,8 +112,6 @@ Linear packageName Texture - javaFileName - atlas_json_array_trimmed.java wrap s @@ -110,12 +122,21 @@ magFilter MagLinear - dataFileName - atlas_json_array_trimmed.json + dataFileNames + + data + + name + atlas_json_hash_trim.json + + java + + name + atlas_json_array_trimmed.java + + multiPack - mainExtension - forceIdenticalLayout outputFormat @@ -129,6 +150,8 @@ trimSpriteNames + cleanTransparentPixels + globalSpriteSettings scale diff --git a/examples/assets/sprites/atlas_array_no_trim.png b/examples/assets/sprites/atlas_array_no_trim.png new file mode 100644 index 00000000..c7982666 Binary files /dev/null and b/examples/assets/sprites/atlas_array_no_trim.png differ diff --git a/examples/assets/sprites/atlas_array_trim.png b/examples/assets/sprites/atlas_array_trim.png new file mode 100644 index 00000000..56686ed9 Binary files /dev/null and b/examples/assets/sprites/atlas_array_trim.png differ diff --git a/examples/assets/sprites/atlas_hash_no_trim.png b/examples/assets/sprites/atlas_hash_no_trim.png new file mode 100644 index 00000000..c7982666 Binary files /dev/null and b/examples/assets/sprites/atlas_hash_no_trim.png differ diff --git a/examples/assets/sprites/atlas_hash_trim.png b/examples/assets/sprites/atlas_hash_trim.png new file mode 100644 index 00000000..56686ed9 Binary files /dev/null and b/examples/assets/sprites/atlas_hash_trim.png differ diff --git a/examples/assets/sprites/atlas_json_array_no_trim.json b/examples/assets/sprites/atlas_json_array_no_trim.json new file mode 100644 index 00000000..60310b19 --- /dev/null +++ b/examples/assets/sprites/atlas_json_array_no_trim.json @@ -0,0 +1,228 @@ +{"frames": [ + +{ + "filename": "cactuar", + "frame": {"x":2,"y":246,"w":231,"h":175}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":231,"h":175}, + "sourceSize": {"w":231,"h":175} +}, +{ + "filename": "carrot", + "frame": {"x":543,"y":418,"w":22,"h":21}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":22,"h":21}, + "sourceSize": {"w":22,"h":21} +}, +{ + "filename": "contra1", + "frame": {"x":335,"y":337,"w":83,"h":169}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":83,"h":169}, + "sourceSize": {"w":83,"h":169} +}, +{ + "filename": "contra3", + "frame": {"x":243,"y":2,"w":246,"h":201}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":246,"h":201}, + "sourceSize": {"w":246,"h":201} +}, +{ + "filename": "darkwing_crazy", + "frame": {"x":649,"y":2,"w":53,"h":49}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":53,"h":49}, + "sourceSize": {"w":53,"h":49} +}, +{ + "filename": "diamond", + "frame": {"x":2,"y":477,"w":32,"h":28}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":32,"h":28}, + "sourceSize": {"w":32,"h":28} +}, +{ + "filename": "eggplant", + "frame": {"x":649,"y":113,"w":16,"h":21}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":16,"h":21}, + "sourceSize": {"w":16,"h":21} +}, +{ + "filename": "firstaid", + "frame": {"x":52,"y":423,"w":32,"h":32}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":32,"h":32}, + "sourceSize": {"w":32,"h":32} +}, +{ + "filename": "ladycop", + "frame": {"x":620,"y":228,"w":87,"h":231}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":87,"h":231}, + "sourceSize": {"w":87,"h":231} +}, +{ + "filename": "melon", + "frame": {"x":567,"y":418,"w":20,"h":20}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":20,"h":20}, + "sourceSize": {"w":20,"h":20} +}, +{ + "filename": "mushroom", + "frame": {"x":86,"y":423,"w":21,"h":21}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":21,"h":21}, + "sourceSize": {"w":21,"h":21} +}, +{ + "filename": "nanoha_taiken_blue", + "frame": {"x":491,"y":2,"w":156,"h":224}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":156,"h":224}, + "sourceSize": {"w":156,"h":224} +}, +{ + "filename": "onion", + "frame": {"x":109,"y":423,"w":21,"h":19}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":21,"h":19}, + "sourceSize": {"w":21,"h":19} +}, +{ + "filename": "oz_pov_melting_disk", + "frame": {"x":421,"y":205,"w":62,"h":116}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":62,"h":116}, + "sourceSize": {"w":62,"h":116} +}, +{ + "filename": "pangball", + "frame": {"x":649,"y":53,"w":32,"h":32}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":32,"h":32}, + "sourceSize": {"w":32,"h":32} +}, +{ + "filename": "pepper", + "frame": {"x":649,"y":87,"w":19,"h":24}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":19,"h":24}, + "sourceSize": {"w":19,"h":24} +}, +{ + "filename": "phaser-dude", + "frame": {"x":514,"y":418,"w":27,"h":40}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":27,"h":40}, + "sourceSize": {"w":27,"h":40} +}, +{ + "filename": "phaser_tiny", + "frame": {"x":421,"y":323,"w":33,"h":8}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":33,"h":8}, + "sourceSize": {"w":33,"h":8} +}, +{ + "filename": "pineapple", + "frame": {"x":683,"y":53,"w":16,"h":23}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":16,"h":23}, + "sourceSize": {"w":16,"h":23} +}, +{ + "filename": "shocktroopers_lulu2", + "frame": {"x":485,"y":228,"w":133,"h":188}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":133,"h":188}, + "sourceSize": {"w":133,"h":188} +}, +{ + "filename": "slime", + "frame": {"x":2,"y":423,"w":48,"h":52}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":48,"h":52}, + "sourceSize": {"w":48,"h":52} +}, +{ + "filename": "sonic_havok_sanity", + "frame": {"x":235,"y":337,"w":98,"h":167}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":98,"h":167}, + "sourceSize": {"w":98,"h":167} +}, +{ + "filename": "spyro", + "frame": {"x":243,"y":205,"w":176,"h":130}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":176,"h":130}, + "sourceSize": {"w":176,"h":130} +}, +{ + "filename": "thrust_ship", + "frame": {"x":514,"y":460,"w":21,"h":28}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":21,"h":28}, + "sourceSize": {"w":21,"h":28} +}, +{ + "filename": "titan_mech", + "frame": {"x":2,"y":2,"w":239,"h":242}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":239,"h":242}, + "sourceSize": {"w":239,"h":242} +}, +{ + "filename": "tomato", + "frame": {"x":52,"y":457,"w":18,"h":17}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":18,"h":17}, + "sourceSize": {"w":18,"h":17} +}, +{ + "filename": "wizball", + "frame": {"x":420,"y":418,"w":92,"h":90}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":92,"h":90}, + "sourceSize": {"w":92,"h":90} +}], +"meta": { + "app": "http://www.codeandweb.com/texturepacker ", + "version": "1.0", + "image": "atlas_array_no_trim.png", + "format": "RGBA8888", + "size": {"w":709,"h":510}, + "scale": "1", + "smartupdate": "$TexturePacker:SmartUpdate:85a06f70f3a4b0203f2a8e85af574dd8:1e240ffed241fc58aca26b0e5d350d80:39425ed36a102a084be538f400103b94$" +} +} diff --git a/examples/assets/sprites/atlas_json_array_trimmed.json b/examples/assets/sprites/atlas_json_array_trim.json similarity index 73% rename from examples/assets/sprites/atlas_json_array_trimmed.json rename to examples/assets/sprites/atlas_json_array_trim.json index f70ecfe9..65e2e468 100644 --- a/examples/assets/sprites/atlas_json_array_trimmed.json +++ b/examples/assets/sprites/atlas_json_array_trim.json @@ -2,7 +2,7 @@ { "filename": "cactuar", - "frame": {"x":2,"y":205,"w":213,"h":159}, + "frame": {"x":249,"y":205,"w":213,"h":159}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":0,"y":0,"w":213,"h":159}, @@ -10,7 +10,7 @@ }, { "filename": "carrot", - "frame": {"x":217,"y":247,"w":22,"h":21}, + "frame": {"x":20,"y":472,"w":22,"h":21}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":22,"h":21}, @@ -18,7 +18,7 @@ }, { "filename": "contra1", - "frame": {"x":160,"y":366,"w":83,"h":169}, + "frame": {"x":464,"y":205,"w":83,"h":169}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":83,"h":169}, @@ -26,7 +26,7 @@ }, { "filename": "contra3", - "frame": {"x":2,"y":2,"w":246,"h":201}, + "frame": {"x":243,"y":2,"w":246,"h":201}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":246,"h":201}, @@ -34,7 +34,7 @@ }, { "filename": "darkwing_crazy", - "frame": {"x":431,"y":364,"w":53,"h":49}, + "frame": {"x":565,"y":361,"w":53,"h":49}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":53,"h":49}, @@ -42,7 +42,7 @@ }, { "filename": "diamond", - "frame": {"x":194,"y":571,"w":32,"h":28}, + "frame": {"x":565,"y":466,"w":32,"h":28}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":32,"h":28}, @@ -50,7 +50,7 @@ }, { "filename": "eggplant", - "frame": {"x":491,"y":72,"w":16,"h":21}, + "frame": {"x":624,"y":58,"w":16,"h":21}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":16,"h":21}, @@ -58,7 +58,7 @@ }, { "filename": "firstaid", - "frame": {"x":160,"y":547,"w":32,"h":32}, + "frame": {"x":615,"y":446,"w":32,"h":32}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":32,"h":32}, @@ -66,7 +66,7 @@ }, { "filename": "ladycop", - "frame": {"x":2,"y":736,"w":87,"h":231}, + "frame": {"x":160,"y":246,"w":87,"h":231}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":87,"h":231}, @@ -74,7 +74,7 @@ }, { "filename": "melon", - "frame": {"x":217,"y":344,"w":20,"h":20}, + "frame": {"x":67,"y":472,"w":20,"h":20}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":20,"h":20}, @@ -82,7 +82,7 @@ }, { "filename": "mushroom", - "frame": {"x":217,"y":300,"w":21,"h":21}, + "frame": {"x":44,"y":472,"w":21,"h":21}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":21,"h":21}, @@ -90,7 +90,7 @@ }, { "filename": "nanoha_taiken_blue", - "frame": {"x":2,"y":366,"w":156,"h":224}, + "frame": {"x":2,"y":246,"w":156,"h":224}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":156,"h":224}, @@ -98,7 +98,7 @@ }, { "filename": "onion", - "frame": {"x":217,"y":323,"w":21,"h":19}, + "frame": {"x":89,"y":472,"w":21,"h":19}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":21,"h":19}, @@ -106,7 +106,7 @@ }, { "filename": "oz_pov_melting_disk", - "frame": {"x":431,"y":246,"w":62,"h":116}, + "frame": {"x":501,"y":376,"w":62,"h":116}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":62,"h":116}, @@ -114,7 +114,7 @@ }, { "filename": "pangball", - "frame": {"x":195,"y":537,"w":32,"h":32}, + "frame": {"x":615,"y":412,"w":32,"h":32}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":32,"h":32}, @@ -122,7 +122,7 @@ }, { "filename": "pepper", - "frame": {"x":491,"y":2,"w":19,"h":24}, + "frame": {"x":624,"y":32,"w":19,"h":24}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":19,"h":24}, @@ -130,7 +130,7 @@ }, { "filename": "phaser-dude", - "frame": {"x":217,"y":205,"w":27,"h":40}, + "frame": {"x":620,"y":361,"w":27,"h":40}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":27,"h":40}, @@ -138,7 +138,7 @@ }, { "filename": "phaser_tiny", - "frame": {"x":160,"y":537,"w":33,"h":8}, + "frame": {"x":407,"y":366,"w":33,"h":8}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":33,"h":8}, @@ -146,7 +146,7 @@ }, { "filename": "pineapple", - "frame": {"x":491,"y":47,"w":16,"h":23}, + "frame": {"x":2,"y":472,"w":16,"h":23}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":16,"h":23}, @@ -154,7 +154,7 @@ }, { "filename": "shocktroopers_lulu2", - "frame": {"x":229,"y":546,"w":131,"h":188}, + "frame": {"x":491,"y":2,"w":131,"h":188}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":1,"y":0,"w":131,"h":188}, @@ -162,7 +162,7 @@ }, { "filename": "slime", - "frame": {"x":431,"y":415,"w":48,"h":52}, + "frame": {"x":565,"y":412,"w":48,"h":52}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":48,"h":52}, @@ -170,7 +170,7 @@ }, { "filename": "sonic_havok_sanity", - "frame": {"x":403,"y":469,"w":98,"h":167}, + "frame": {"x":549,"y":192,"w":98,"h":167}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":98,"h":167}, @@ -178,7 +178,7 @@ }, { "filename": "spyro", - "frame": {"x":245,"y":430,"w":156,"h":114}, + "frame": {"x":249,"y":366,"w":156,"h":114}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":0,"y":0,"w":156,"h":114}, @@ -186,7 +186,7 @@ }, { "filename": "thrust_ship", - "frame": {"x":217,"y":270,"w":21,"h":28}, + "frame": {"x":624,"y":2,"w":21,"h":28}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":21,"h":28}, @@ -194,7 +194,7 @@ }, { "filename": "titan_mech", - "frame": {"x":250,"y":2,"w":239,"h":242}, + "frame": {"x":2,"y":2,"w":239,"h":242}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":239,"h":242}, @@ -202,7 +202,7 @@ }, { "filename": "tomato", - "frame": {"x":491,"y":28,"w":18,"h":17}, + "frame": {"x":112,"y":472,"w":18,"h":17}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":18,"h":17}, @@ -210,19 +210,19 @@ }, { "filename": "wizball", - "frame": {"x":246,"y":246,"w":183,"h":182}, + "frame": {"x":407,"y":376,"w":92,"h":90}, "rotated": false, - "trimmed": true, - "spriteSourceSize": {"x":4,"y":2,"w":183,"h":182}, - "sourceSize": {"w":195,"h":188} + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":92,"h":90}, + "sourceSize": {"w":92,"h":90} }], "meta": { "app": "http://www.codeandweb.com/texturepacker ", "version": "1.0", - "image": "atlas_json_array_trimmed.png", + "image": "atlas_array_trim.png", "format": "RGBA8888", - "size": {"w":512,"h":1024}, + "size": {"w":650,"h":497}, "scale": "1", - "smartupdate": "$TexturePacker:SmartUpdate:c3013af70e8e46c48c1f140e4eb1a651:1/1$" + "smartupdate": "$TexturePacker:SmartUpdate:b6887183d8c9d806808577d524d4a2b9:1e240ffed241fc58aca26b0e5d350d80:71eda69c52f7d9873cb6f00d13e1e2f8$" } } diff --git a/examples/assets/sprites/atlas_json_array_trimmed.png b/examples/assets/sprites/atlas_json_array_trimmed.png deleted file mode 100644 index f844e71c..00000000 Binary files a/examples/assets/sprites/atlas_json_array_trimmed.png and /dev/null differ diff --git a/examples/assets/sprites/atlas_json_hash_no_trim.json b/examples/assets/sprites/atlas_json_hash_no_trim.json new file mode 100644 index 00000000..7295f098 --- /dev/null +++ b/examples/assets/sprites/atlas_json_hash_no_trim.json @@ -0,0 +1,228 @@ +{"frames": { + +"cactuar": +{ + "frame": {"x":2,"y":246,"w":231,"h":175}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":231,"h":175}, + "sourceSize": {"w":231,"h":175} +}, +"carrot": +{ + "frame": {"x":543,"y":418,"w":22,"h":21}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":22,"h":21}, + "sourceSize": {"w":22,"h":21} +}, +"contra1": +{ + "frame": {"x":335,"y":337,"w":83,"h":169}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":83,"h":169}, + "sourceSize": {"w":83,"h":169} +}, +"contra3": +{ + "frame": {"x":243,"y":2,"w":246,"h":201}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":246,"h":201}, + "sourceSize": {"w":246,"h":201} +}, +"darkwing_crazy": +{ + "frame": {"x":649,"y":2,"w":53,"h":49}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":53,"h":49}, + "sourceSize": {"w":53,"h":49} +}, +"diamond": +{ + "frame": {"x":2,"y":477,"w":32,"h":28}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":32,"h":28}, + "sourceSize": {"w":32,"h":28} +}, +"eggplant": +{ + "frame": {"x":649,"y":113,"w":16,"h":21}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":16,"h":21}, + "sourceSize": {"w":16,"h":21} +}, +"firstaid": +{ + "frame": {"x":52,"y":423,"w":32,"h":32}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":32,"h":32}, + "sourceSize": {"w":32,"h":32} +}, +"ladycop": +{ + "frame": {"x":620,"y":228,"w":87,"h":231}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":87,"h":231}, + "sourceSize": {"w":87,"h":231} +}, +"melon": +{ + "frame": {"x":567,"y":418,"w":20,"h":20}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":20,"h":20}, + "sourceSize": {"w":20,"h":20} +}, +"mushroom": +{ + "frame": {"x":86,"y":423,"w":21,"h":21}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":21,"h":21}, + "sourceSize": {"w":21,"h":21} +}, +"nanoha_taiken_blue": +{ + "frame": {"x":491,"y":2,"w":156,"h":224}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":156,"h":224}, + "sourceSize": {"w":156,"h":224} +}, +"onion": +{ + "frame": {"x":109,"y":423,"w":21,"h":19}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":21,"h":19}, + "sourceSize": {"w":21,"h":19} +}, +"oz_pov_melting_disk": +{ + "frame": {"x":421,"y":205,"w":62,"h":116}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":62,"h":116}, + "sourceSize": {"w":62,"h":116} +}, +"pangball": +{ + "frame": {"x":649,"y":53,"w":32,"h":32}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":32,"h":32}, + "sourceSize": {"w":32,"h":32} +}, +"pepper": +{ + "frame": {"x":649,"y":87,"w":19,"h":24}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":19,"h":24}, + "sourceSize": {"w":19,"h":24} +}, +"phaser-dude": +{ + "frame": {"x":514,"y":418,"w":27,"h":40}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":27,"h":40}, + "sourceSize": {"w":27,"h":40} +}, +"phaser_tiny": +{ + "frame": {"x":421,"y":323,"w":33,"h":8}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":33,"h":8}, + "sourceSize": {"w":33,"h":8} +}, +"pineapple": +{ + "frame": {"x":683,"y":53,"w":16,"h":23}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":16,"h":23}, + "sourceSize": {"w":16,"h":23} +}, +"shocktroopers_lulu2": +{ + "frame": {"x":485,"y":228,"w":133,"h":188}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":133,"h":188}, + "sourceSize": {"w":133,"h":188} +}, +"slime": +{ + "frame": {"x":2,"y":423,"w":48,"h":52}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":48,"h":52}, + "sourceSize": {"w":48,"h":52} +}, +"sonic_havok_sanity": +{ + "frame": {"x":235,"y":337,"w":98,"h":167}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":98,"h":167}, + "sourceSize": {"w":98,"h":167} +}, +"spyro": +{ + "frame": {"x":243,"y":205,"w":176,"h":130}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":176,"h":130}, + "sourceSize": {"w":176,"h":130} +}, +"thrust_ship": +{ + "frame": {"x":514,"y":460,"w":21,"h":28}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":21,"h":28}, + "sourceSize": {"w":21,"h":28} +}, +"titan_mech": +{ + "frame": {"x":2,"y":2,"w":239,"h":242}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":239,"h":242}, + "sourceSize": {"w":239,"h":242} +}, +"tomato": +{ + "frame": {"x":52,"y":457,"w":18,"h":17}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":18,"h":17}, + "sourceSize": {"w":18,"h":17} +}, +"wizball": +{ + "frame": {"x":420,"y":418,"w":92,"h":90}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":92,"h":90}, + "sourceSize": {"w":92,"h":90} +}}, +"meta": { + "app": "http://www.codeandweb.com/texturepacker ", + "version": "1.0", + "image": "atlas_hash_no_trim.png", + "format": "RGBA8888", + "size": {"w":709,"h":510}, + "scale": "1", + "smartupdate": "$TexturePacker:SmartUpdate:3eeb3bf69bcd678090519854856c0b3d:1e240ffed241fc58aca26b0e5d350d80:2559992b5833be13122ec285ebb92d0d$" +} +} diff --git a/examples/assets/sprites/atlas_json_hash_trim.json b/examples/assets/sprites/atlas_json_hash_trim.json new file mode 100644 index 00000000..91b5eef6 --- /dev/null +++ b/examples/assets/sprites/atlas_json_hash_trim.json @@ -0,0 +1,228 @@ +{"frames": { + +"cactuar": +{ + "frame": {"x":249,"y":205,"w":213,"h":159}, + "rotated": false, + "trimmed": true, + "spriteSourceSize": {"x":0,"y":0,"w":213,"h":159}, + "sourceSize": {"w":231,"h":175} +}, +"carrot": +{ + "frame": {"x":20,"y":472,"w":22,"h":21}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":22,"h":21}, + "sourceSize": {"w":22,"h":21} +}, +"contra1": +{ + "frame": {"x":464,"y":205,"w":83,"h":169}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":83,"h":169}, + "sourceSize": {"w":83,"h":169} +}, +"contra3": +{ + "frame": {"x":243,"y":2,"w":246,"h":201}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":246,"h":201}, + "sourceSize": {"w":246,"h":201} +}, +"darkwing_crazy": +{ + "frame": {"x":565,"y":361,"w":53,"h":49}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":53,"h":49}, + "sourceSize": {"w":53,"h":49} +}, +"diamond": +{ + "frame": {"x":565,"y":466,"w":32,"h":28}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":32,"h":28}, + "sourceSize": {"w":32,"h":28} +}, +"eggplant": +{ + "frame": {"x":624,"y":58,"w":16,"h":21}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":16,"h":21}, + "sourceSize": {"w":16,"h":21} +}, +"firstaid": +{ + "frame": {"x":615,"y":446,"w":32,"h":32}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":32,"h":32}, + "sourceSize": {"w":32,"h":32} +}, +"ladycop": +{ + "frame": {"x":160,"y":246,"w":87,"h":231}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":87,"h":231}, + "sourceSize": {"w":87,"h":231} +}, +"melon": +{ + "frame": {"x":67,"y":472,"w":20,"h":20}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":20,"h":20}, + "sourceSize": {"w":20,"h":20} +}, +"mushroom": +{ + "frame": {"x":44,"y":472,"w":21,"h":21}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":21,"h":21}, + "sourceSize": {"w":21,"h":21} +}, +"nanoha_taiken_blue": +{ + "frame": {"x":2,"y":246,"w":156,"h":224}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":156,"h":224}, + "sourceSize": {"w":156,"h":224} +}, +"onion": +{ + "frame": {"x":89,"y":472,"w":21,"h":19}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":21,"h":19}, + "sourceSize": {"w":21,"h":19} +}, +"oz_pov_melting_disk": +{ + "frame": {"x":501,"y":376,"w":62,"h":116}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":62,"h":116}, + "sourceSize": {"w":62,"h":116} +}, +"pangball": +{ + "frame": {"x":615,"y":412,"w":32,"h":32}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":32,"h":32}, + "sourceSize": {"w":32,"h":32} +}, +"pepper": +{ + "frame": {"x":624,"y":32,"w":19,"h":24}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":19,"h":24}, + "sourceSize": {"w":19,"h":24} +}, +"phaser-dude": +{ + "frame": {"x":620,"y":361,"w":27,"h":40}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":27,"h":40}, + "sourceSize": {"w":27,"h":40} +}, +"phaser_tiny": +{ + "frame": {"x":407,"y":366,"w":33,"h":8}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":33,"h":8}, + "sourceSize": {"w":33,"h":8} +}, +"pineapple": +{ + "frame": {"x":2,"y":472,"w":16,"h":23}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":16,"h":23}, + "sourceSize": {"w":16,"h":23} +}, +"shocktroopers_lulu2": +{ + "frame": {"x":491,"y":2,"w":131,"h":188}, + "rotated": false, + "trimmed": true, + "spriteSourceSize": {"x":1,"y":0,"w":131,"h":188}, + "sourceSize": {"w":133,"h":188} +}, +"slime": +{ + "frame": {"x":565,"y":412,"w":48,"h":52}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":48,"h":52}, + "sourceSize": {"w":48,"h":52} +}, +"sonic_havok_sanity": +{ + "frame": {"x":549,"y":192,"w":98,"h":167}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":98,"h":167}, + "sourceSize": {"w":98,"h":167} +}, +"spyro": +{ + "frame": {"x":249,"y":366,"w":156,"h":114}, + "rotated": false, + "trimmed": true, + "spriteSourceSize": {"x":0,"y":0,"w":156,"h":114}, + "sourceSize": {"w":176,"h":130} +}, +"thrust_ship": +{ + "frame": {"x":624,"y":2,"w":21,"h":28}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":21,"h":28}, + "sourceSize": {"w":21,"h":28} +}, +"titan_mech": +{ + "frame": {"x":2,"y":2,"w":239,"h":242}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":239,"h":242}, + "sourceSize": {"w":239,"h":242} +}, +"tomato": +{ + "frame": {"x":112,"y":472,"w":18,"h":17}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":18,"h":17}, + "sourceSize": {"w":18,"h":17} +}, +"wizball": +{ + "frame": {"x":407,"y":376,"w":92,"h":90}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":92,"h":90}, + "sourceSize": {"w":92,"h":90} +}}, +"meta": { + "app": "http://www.codeandweb.com/texturepacker ", + "version": "1.0", + "image": "atlas_hash_trim.png", + "format": "RGBA8888", + "size": {"w":650,"h":497}, + "scale": "1", + "smartupdate": "$TexturePacker:SmartUpdate:a12d042c8df389efb88ea09fd76942c5:1e240ffed241fc58aca26b0e5d350d80:a1ac42a292480379863f711d5e64cebf$" +} +} diff --git a/examples/wip/atlas_trim_array.js b/examples/wip/atlas_trim_array.js new file mode 100644 index 00000000..a3c09512 --- /dev/null +++ b/examples/wip/atlas_trim_array.js @@ -0,0 +1,24 @@ + +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create }); + +function preload() { + + // Non-trimmed + // game.load.atlasJSONArray('atlas', 'assets/sprites/atlas_array_no_trim.png', 'assets/sprites/atlas_json_array_no_trim.json'); + // game.load.atlasJSONHash('atlas', 'assets/sprites/atlas_hash_no_trim.png', 'assets/sprites/atlas_json_hash_no_trim.json'); + + // Trimmed + // game.load.atlasJSONArray('atlas', 'assets/sprites/atlas_array_trim.png', 'assets/sprites/atlas_json_array_trim.json'); + game.load.atlasJSONHash('atlas', 'assets/sprites/atlas_hash_trim.png', 'assets/sprites/atlas_json_hash_trim.json'); + +} + +var sprite; + +function create() { + + sprite = game.add.sprite(330, 100, 'atlas', 'nanoha_taiken_blue'); + + sprite = game.add.sprite(530, 100, 'atlas', 'ladycop'); + +} diff --git a/src/animation/AnimationParser.js b/src/animation/AnimationParser.js index e13e69bf..2d23418d 100644 --- a/src/animation/AnimationParser.js +++ b/src/animation/AnimationParser.js @@ -155,6 +155,7 @@ Phaser.AnimationParser = { PIXI.TextureCache[uuid].trim = new Phaser.Rectangle(frames[i].spriteSourceSize.x, frames[i].spriteSourceSize.y, frames[i].sourceSize.w, frames[i].sourceSize.h); } + } return data; @@ -221,7 +222,7 @@ Phaser.AnimationParser = { frames[key].spriteSourceSize.h ); - PIXI.TextureCache[uuid].trim = new Phaser.Rectangle(frames[i].spriteSourceSize.x, frames[i].spriteSourceSize.y, frames[i].sourceSize.w, frames[i].sourceSize.h); + PIXI.TextureCache[uuid].trim = new Phaser.Rectangle(frames[key].spriteSourceSize.x, frames[key].spriteSourceSize.y, frames[key].sourceSize.w, frames[key].sourceSize.h); } i++;