您的位置:首页 > 其它

TexturePacker使用技巧总结

2015-07-07 03:14 302 查看
一、合图相关技巧

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: