博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
cocos2d-x plist使用
阅读量:7077 次
发布时间:2019-06-28

本文共 3125 字,大约阅读时间需要 10 分钟。

  windows下通过TexturePacker将单个的sprite放入

  导出 niao.png        和         niao.plist

View Code
1 
2 3
4
5
frames
6
7
xiangsique_feixiang_001.png
8
9
frame
10
{
{0,73},{47,73}}
11
offset
12
{2,0}
13
rotated
14
15
sourceColorRect
16
{
{4,0},{47,73}}
17
sourceSize
18
{51,73}
19
20
xiangsique_feixiang_002.png
21
22
frame
23
{
{0,0},{47,73}}
24
offset
25
{2,0}
26
rotated
27
28
sourceColorRect
29
{
{4,1},{47,73}}
30
sourceSize
31
{51,75}
32
33
34
metadata
35
36
format
37
2
38
realTextureFileName
39
yingwu.png
40
size
41
{128,128}
42
textureFileName
43
yingwu.png
44
45
46

  将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. 

转载于:https://www.cnblogs.com/wendao/archive/2011/12/13/egn_cocos2dx_plist.html

你可能感兴趣的文章
ASP.NET MVC Model绑定的简单应用
查看>>
长期演进技术(LTE,Long Term Evolution)
查看>>
数学之路-python计算实战(5)-初识numpy以及pypy下执行numpy
查看>>
SQL--类型转换
查看>>
VGG_19 train_vali.prototxt file
查看>>
获取文件或是文件夹的大小和占用空间
查看>>
libssh2进行远程运行LINUX命令
查看>>
Android Gson深入分析
查看>>
Android中自动跳转到系统设置界面
查看>>
树后台数据存储(採用webmethod)
查看>>
Android利用Fiddler进行网络数据抓包【怎么跟踪微信请求】
查看>>
memcached系列之二
查看>>
树的左旋与右旋
查看>>
Atitit. 如何判断软件工程师 能力模型 程序员能力模型 项目经理能力模型...
查看>>
每周算法讲堂,二分法
查看>>
2016第8周五
查看>>
CSS3文本溢出显示省略号
查看>>
zookeeper系列之通信模型(转)
查看>>
js动态判断密码强度&&实用的 jQuery 代码片段
查看>>
Android实例-获取程序版本号(XE10+小米2)
查看>>