unsigned long fZize = 0;
unsigned char * buff = NULL;
//获得全部路径
const char *path = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("Image.zip");
//从zip中读取图片数据
buff = CCFileUtils::sharedFileUtils()->getFileDataFromZip(path,"1.png",&fZize);
//创建Image、创建img纹理、创建纹理精灵
CCImage *img = new CCImage();
img->initWithImageData(buff,fZize,img->kFmtPng);
CCTexture2D *texture = new CCTexture2D();
texture->initWithImage(img);
CCSprite *sprite = CCSprite::createWithTexture(texture);
sprite->setPosition(ccp(s.width/2,s.height/2));
addChild(sprite);
cocos2d-x读取ZIP中的图片名称
最新推荐文章于 2019-12-09 17:20:16 发布