`
song020cn
  • 浏览: 61836 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

将TexturePacker集成到XCode

阅读更多

TexturePacker: http://www.codeandweb.com/texturepacker

 

将TexturePacker集成到XCode,有一个好处,就是你不再需要将生成的png大图上传到svn或者github了。

如果英文允许的话,建议参考本文最后的参考文章链接。

 

1、项目结构图



 

多说一句,其实Assets目录不需要添加到Project中去,因为所有的资源都已经生成到plist, png文件中了。上图作为一个目录结构参考更合适。

 

2、shell脚本

使用TexturePacker命令来生成相应的png资源

#! /bin/sh
TP=/usr/local/bin/TexturePacker
if [ "${ACTION}" = "clean" ]
then
# remove sheets - please add a matching expression here
rm ../Resources/sheet*.png
rm ../Resources/sheet*.plist
else
# create all assets from tps files
${TP} *.tps
fi

exit 0

 如果需要生成不同尺寸的资源,例如ipadHD和ipad的

#! /bin/sh
TP=/usr/local/bin/TexturePacker
if [ "${ACTION}" = "clean" ]
then
# remove all files
rm ../Resources/sheet*.png
rm ../Resources/sheet*.plist
else
# create hd & sd assets
${TP} --smart-update sheet1 \
--auto-sd \
--format cocos2d \
--data ../Resources/sheet-hd.plist \
--sheet ../Resources/sheet-hd.png
 
# create ipad assets from same sprites
${TP} --smart-update --scale 1.066 sheet1 \
--format cocos2d \
--data ../Resources/sheet-ipad.plist \
--sheet ../Resources/sheet-ipad.png
 
... add more sheets ....
fi
exit 0

 

对于文中的参数含义,可以通过命令

/usr/local/bin/TexturePacker --help

 来查看。

 

3、将shell脚本集成到XCode5

如果你用的XCode4,建议查看文章最后的参考文章链接。


 

 在弹出的模板界面中的选择Other/External Build System



 配置好New Target的Info后,添加Target Dependencies


 

 That's all.

 

更详细步骤参考以下链接。

 

参考文章:

Tutorial: XCode4 integration of TexturePacker for Cocos2d and Sparrow framework

  • 大小: 127.5 KB
  • 大小: 74.9 KB
  • 大小: 207.2 KB
  • 大小: 35.7 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics