如果想要修改一个plist文件新打包成plist,而此刻原来的小图都找不到了,那只能把plist分解了,代码如下:

void UiManage::DecodePlist(string imgPath,string plistPath)
{
FileUtils *pFileUtil=FileUtils::getInstance();
SpriteFrameCache *pFramChace=SpriteFrameCache::getInstance();
pFramChace->addSpriteFramesWithFile(plistPath,imgPath); ValueMap plistDic=pFileUtil->getValueMapFromFile(plistPath);
if (plistDic.find("frames")!=plistDic.end())
{
Point pos(,); ValueMap framesDic=plistDic["frames"].asValueMap();
for (auto it=framesDic.begin();it!=framesDic.end();it++)
{
string imgName=it->first;
string savePath="screenshot/"+imgName;
//SpriteFrame *pFrame=pFramChace->getSpriteFrameByName(imgName);
Sprite *pSpr=Sprite::createWithSpriteFrameName(imgName);
if (pSpr)
{
Size imgSize=pSpr->getContentSize();
RenderTexture *pRenderTexture=RenderTexture::create(imgSize.width,imgSize.height); pRenderTexture->begin(); pRenderTexture->setAnchorPoint(pos);
pSpr->setAnchorPoint(pos);
pSpr->setPosition(pos);
pSpr->visit(); pRenderTexture->end();
pRenderTexture->saveToFile(savePath,Image::Format::PNG);
CCLOG("save img %s",imgName.c_str()); //CC_SAFE_RELEASE(pRenderTexture);
//CC_SAFE_RELEASE(pSpr);
pFramChace->removeSpriteFrameByName(imgName);
} }
}
}

最新文章

  1. CentOS 7 环境配置
  2. 滑动的scrollowview的导航渐变
  3. 【开源分享:入门到精通ASP.NET MVC+EF6+Bootstrap】从这里开始,一起搭框架(1)开篇介绍
  4. python3 连接SQLserver
  5. 【C语言入门教程】4.9 指向指针的指针
  6. C#/ASP.NET MVC微信公众号接口开发之从零开发(二) 接收微信消息并且解析XML(附源码)
  7. Python学习教程(learning Python)--3.3.1 Python下的布尔表达式
  8. 【BZOJ】【1069】【SCOI2007】最大土地面积
  9. Node Security
  10. Android 联系人字母排序(仿微信)
  11. appserv在哪修改服务器名
  12. 10_Mybatis开发Dao方法——mapper代理实现
  13. Eclipse启动Tomcat报错,系统缺少本地apr库
  14. cf C Bear and Prime Numbers
  15. fis-plus 学习笔记
  16. Java框架之Spring(四)
  17. Java中空串和null串的区别
  18. onceAgain, 这是一个py群的群公告说明
  19. <自动化测试方案_4>第四章、选型标准
  20. Git- 命令及使用

热门文章

  1. linux命令 --> pwd命令
  2. Python 文件操作模块 shutil 详解
  3. MATLAB的基本元素
  4. try{return} finally
  5. HTML5规范的本地存储
  6. VS2015+AngularJS+Ionic开发
  7. C# IO操作(二)File类和Directory类的常用方法
  8. string[] 和 arraylist互转及问题解决
  9. javascript 正则 验证 第25节
  10. 如何在浏览器网页中实现java小应用程序的功能