cocos2dx 加密spine文件遇到的问题(暂时没有解决方法)

今天我研究了一下加密spine动画的加密的方法,图片肯定要加密的,所以我只选择加密图片,另外的一个altas文件和json文件就不做加密打算。

我的思路是通过TexturePacker打包成加密的文件,然后用spriteframecache读取后,遍历所有spriteframe,然后将spriteframe转成image,存储在

TextureCache中保存,以下是SkeletonAnimation读取图片文件的源代码过程:

void _spAtlasPage_createTexture (spAtlasPage* self, const char* path) {

  Texture2D* texture = Director::getInstance()->getTextureCache()->addImage(path);

  texture->retain();

  self->rendererObject = texture;

  self->width = texture->getPixelsWide();

  self->height = texture->getPixelsHigh();

}

Spine 动画的纹理都是保存在TextureCache中保存,而且addImage()函数是通过全路径来获取纹理,如果全路径没有该图片文件,直接返回空指针,所以,纹理必须保存在全路径中,纹理保存在缓存中在读取出来很明显行不通,所以我打算继续使用TexturePacker加密的方法,修改spine框架,使他通过getTextureForKey来读取,

明天继续。。。。

转载请注明出处,from 博客园 HemJohn

原文地址:https://www.cnblogs.com/HemJohn/p/4876101.html