一、合图相关技巧
1.Trim参数可以指定是否消除png图片周围的空白区域。
合图完成之后,将会产生plist文件和png文件,需要在Cocos2dx里面导入。
二、Cocos2dx中导入
//添加到精灵帧缓存中 SpriteFrameCache::getInstance()->addSpriteFramesWithFile("texturepacker.plist", "texturepacker.png"); //使用精灵帧缓存中得数据来初始化精灵 Sprite* button = Sprite::createWithSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("button_close.png")); button->setAnchorPoint(Vec2(0, 0)); button->setPosition(Vec2(0, 0)); this->addChild(button);
三、外部链接
这个网址对有些选项的解释很到位:http://blog.csdn.net/azhou_hui/article/details/9113907