Cocos2d-x—使用TexturePacker对图片进行打包、加密
2015-02-16 00:00
501 查看
Cocos2d-x是以2的n次方的内存来加载图片资源的,也就是说如果加载一张80*80的图片,将会消耗128*128的内存,这样会浪费很多内存。这时候就需要一个工具将多张图片拼接成一张大图。TexturePacker就是这样一款工具。下载地址:https://www.codeandweb.com/texturepacker
Data Format:选择导出游戏引擎支持的数据类型,直接使用默认的cocos2d就可以
Data File:文件保存的路径
Texture Format:图片纹理的数据格式,推荐使用.pvr.ccz
Texture File:纹理图片的路径
Content protection:这个选项是对纹理图片进行加密,点击后会提示输入一个128位的key值(系统可以自动生成)。
使用步骤:
1.直接将图片拖入右边的空白处;
2.填写输出路径
3.点击Geometry->Size constraints,选择NPOT
4.点击Publish输出文件。
5.在cocos2d-x中加载图片,代码如下
[cpp]
view plain
copy
print
?
#include "support/zip_support/ZipUtils.h"
[cpp]
view plain
copy
print
?
//0xa83cca27,0x50f49f7b,0xddbe7d95,0x2b955dd8是将128位的key值分成4部分,每部分32位
ZipUtils::ccSetPvrEncryptionKey(0xa83cca27,0x50f49f7b,0xddbe7d95,0x2b955dd8);
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("test.plist", "test.pvr.ccz");
CCSprite *nonencryptedSprite = CCSprite::createWithSpriteFrameName("grossini.png");
转自:http://blog.csdn.net/yifuteli_kevin/article/details/22599853
[cpp]
view plain
copy
print
?
#include "support/zip_support/ZipUtils.h"
[cpp]
view plain
copy
print
?
//0xa83cca27,0x50f49f7b,0xddbe7d95,0x2b955dd8是将128位的key值分成4部分,每部分32位
ZipUtils::ccSetPvrEncryptionKey(0xa83cca27,0x50f49f7b,0xddbe7d95,0x2b955dd8);
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("test.plist", "test.pvr.ccz");
CCSprite *nonencryptedSprite = CCSprite::createWithSpriteFrameName("grossini.png");
Data Format:选择导出游戏引擎支持的数据类型,直接使用默认的cocos2d就可以
Data File:文件保存的路径
Texture Format:图片纹理的数据格式,推荐使用.pvr.ccz
Texture File:纹理图片的路径
Content protection:这个选项是对纹理图片进行加密,点击后会提示输入一个128位的key值(系统可以自动生成)。
使用步骤:
1.直接将图片拖入右边的空白处;
2.填写输出路径
3.点击Geometry->Size constraints,选择NPOT
4.点击Publish输出文件。
5.在cocos2d-x中加载图片,代码如下
[cpp]
view plain
copy
?
#include "support/zip_support/ZipUtils.h"
[cpp]
view plain
copy
?
//0xa83cca27,0x50f49f7b,0xddbe7d95,0x2b955dd8是将128位的key值分成4部分,每部分32位
ZipUtils::ccSetPvrEncryptionKey(0xa83cca27,0x50f49f7b,0xddbe7d95,0x2b955dd8);
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("test.plist", "test.pvr.ccz");
CCSprite *nonencryptedSprite = CCSprite::createWithSpriteFrameName("grossini.png");
转自:http://blog.csdn.net/yifuteli_kevin/article/details/22599853
[cpp]
view plain
copy
?
#include "support/zip_support/ZipUtils.h"
[cpp]
view plain
copy
?
//0xa83cca27,0x50f49f7b,0xddbe7d95,0x2b955dd8是将128位的key值分成4部分,每部分32位
ZipUtils::ccSetPvrEncryptionKey(0xa83cca27,0x50f49f7b,0xddbe7d95,0x2b955dd8);
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("test.plist", "test.pvr.ccz");
CCSprite *nonencryptedSprite = CCSprite::createWithSpriteFrameName("grossini.png");
相关文章推荐
- Cocos2d-x—使用TexturePacker对图片进行打包、加密
- Cocos2d-x—使用TexturePacker对图片进行打包、加密
- Cocos2d-x—使用TexturePacker对图片进行打包、加密
- Cocos2d-x—使用TexturePacker对图片进行打包、加密
- Cocos2d-x笔记(六)—使用TexturePacker对图片进行打包、加密
- Cocos2d-x—使用TexturePacker对图片进行打包、加密
- TexturePacker打包后的带透明度的图片在cocos2d-x中使用时有黑边
- TexturePacker打包图片并使用addImageAsync实现longding界面异步加载图片纹理---cocos2d-x学习之路
- TexturePacker 图片打包工具讲解与使用并且批处理打多包以及资源加密
- cocos2d-x使用TexturePacker打包图片及使用生成的plist文件创建精灵动画
- TexturePacker 图片打包工具讲解与使用并且批处理打多包以及资源加密
- TexturePacker 图片打包工具讲解与使用并且批处理打多包以及资源加密
- TexturePacker 图片打包工具讲解与使用并且批处理打多包以及资源加密
- TexturePacker打包图片并使用addImageAsync实现longding界面异步加载图片纹理---cocos2d-x学习之路[3]
- cocos2d-x使用TexturePacker打包图片及使用生成的plist文件创建精灵动画
- 【Cococs2d-x】通过TexturePacker加密图片资源(Cocos2d-x方式)
- Cococs2d-x通过TexturePacker加密图片资源(Cocos2d-x方式)
- 【Cococs2d-x】通过TexturePacker加密图片资源(Cocos2d-x方式)
- 【Cococs2d-x】通过TexturePacker加密图片资源(Cocos2d-x方式)
- TexturePacker图片打包工具——简单介绍+简单制作图片集教程——cocos2d-x游戏开发引擎图片制作必备