windows下通过TexturePacker将单个的sprite放入
导出 niao.png 和 niao.plist
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
![](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
1 2 34 5 46frames 67 34xiangsique_feixiang_001.png 89 20frame 10{ {0,73},{47,73}} 11offset 12{2,0} 13rotated 1415 sourceColorRect 16{ {4,0},{47,73}} 17sourceSize 18{51,73} 19xiangsique_feixiang_002.png 2122 33frame 23{ {0,0},{47,73}} 24offset 25{2,0} 26rotated 2728 sourceColorRect 29{ {4,1},{47,73}} 30sourceSize 31{51,75} 32metadata 3536 45format 372 38realTextureFileName 39yingwu.png 40size 41{128,128} 42textureFileName 43yingwu.png 44
将niao.png和niao.plist放入visual studio的 Resources目录下。
1 CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("niao.plist"); 2 3 eagle_sprite_->initWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("xiangsique_feixiang_001.png"));
在plist中只需要管sprite的<key>xiangsique_feixiang_001.png</key>
使用合成的png加plist的好处:目前使用的比较少没啥感觉,现在看来最明显的好处就是不让png文件很多很杂乱; 这个待补充。
好处: 1.Reduced OpenGL ES bind calls-the more images contained the textrue atlas, the greater the reduction. 2.Reduced memory footprint for the images stored as textrue in memory. 3.Easy method to trim and save on transparent apace in your images,allowing for more images/texture in the same apace. 4.Zwoptex and TexturePacker are fully supported by cocos2d, so creating and using texture atlases is painless.