日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

cocos2d-x plist使用

發布時間:2025/3/20 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 cocos2d-x plist使用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

  windows下通過TexturePacker將單個的sprite放入

  導出 niao.png????????和???????? niao.plist

View Code 1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 <plist version="1.0">
4 <dict>
5 <key>frames</key>
6 <dict>
7 <key>xiangsique_feixiang_001.png</key>
8 <dict>
9 <key>frame</key>
10 <string>{{0,73},{47,73}}</string>
11 <key>offset</key>
12 <string>{2,0}</string>
13 <key>rotated</key>
14 <true/>
15 <key>sourceColorRect</key>
16 <string>{{4,0},{47,73}}</string>
17 <key>sourceSize</key>
18 <string>{51,73}</string>
19 </dict>
20 <key>xiangsique_feixiang_002.png</key>
21 <dict>
22 <key>frame</key>
23 <string>{{0,0},{47,73}}</string>
24 <key>offset</key>
25 <string>{2,0}</string>
26 <key>rotated</key>
27 <false/>
28 <key>sourceColorRect</key>
29 <string>{{4,1},{47,73}}</string>
30 <key>sourceSize</key>
31 <string>{51,75}</string>
32 </dict>
33 </dict>
34 <key>metadata</key>
35 <dict>
36 <key>format</key>
37 <integer>2</integer>
38 <key>realTextureFileName</key>
39 <string>yingwu.png</string>
40 <key>size</key>
41 <string>{128,128}</string>
42 <key>textureFileName</key>
43 <string>yingwu.png</string>
44 </dict>
45 </dict>
46 </plist>

  將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.?

write by fgd

轉載于:https://www.cnblogs.com/wendao/archive/2011/12/13/egn_cocos2dx_plist.html

總結

以上是生活随笔為你收集整理的cocos2d-x plist使用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。