Size visibleSize = Director::getInstance()->getVisibleSize();
Point origin = Director::getInstance()->getVisibleOrigin(); std::string path = FileUtils::getInstance()->fullPathForFilename("story.json");
std::string document = FileUtils::getInstance()->getStringFromFile(path.c_str());
rapidjson::Document doc;
doc.Parse<0>(document.c_str()); rapidjson::Value &datas = doc["datas"];
if (_dataIndex >= datas.Size())
{
return;
}
std::string name = datas[_dataIndex]["name"].GetString();
std::string msg = datas[_dataIndex]["msg"].GetString();
std::string picture = datas[_dataIndex]["picture"].GetString(); this->removeAllChildrenWithCleanup(true); auto label = LabelTTF::create(name, "Arial", 24); // position the label on the center of the screen
label->setPosition(Point(origin.x + visibleSize.width / 2,
origin.y + visibleSize.height - label->getContentSize().height)); // add the label as a child to this layer
this->addChild(label, 1); auto labels = LabelTTF::create(msg, "Arial", 24,Size(300,0)); // position the label on the center of the screen
labels->setPosition(Point(origin.x + visibleSize.width / 2,
origin.y + visibleSize.height*3/4 - labels->getContentSize().height)); // add the label as a child to this layer
this->addChild(labels, 1); _dataIndex++;

cocos2d-x  3.0 交流群: 367086379

cocos2d-x 3.0 rapidJson 解析操作应该注意的细节的更多相关文章

  1. Cocos2d-X网络编程(5) 使用Rapidjson解析数据

    Json基础及28种c++解析库性能对比 JSON 概念和特点:     JSON 指的是 JavaScript 对象表示法(JavaScript Object Notation)     JSON ...

  2. IIS6.0文件解析漏洞小结

    今天搞站,本来这个站是aspx的,webserver是IIS6.0的,进入后台之后,发现有一个上传图片的地方,于是,我就上传了一张asp/aspx的一句话图片木马,但是用菜刀连接的时候,没有成功get ...

  3. 在.NET2.0中解析Json和Xml

    在.NET解析json有很多方法,这里介绍最简单也用的最多的一种. 一.添加引用 解析Json,先下载开源控件 Newtonsoft.Json.dll 下载地址:http://files.cnblog ...

  4. 连接SQLServer时提示“但是在登录前的握手期间发生错误。 (provider: SSL Provider, error: 0 - 等待的操作过时”解决办法

    解决:"已成功与服务器建立连接,但是在登录前的握手期间发生错误. (provider: SSL Provider, error: 0 - 等待的操作过时" 官方问题介绍:http: ...

  5. 已成功与服务器建立连接,但是在登录前的握手期间发生错误。 (provider: SSL Provider, error: 0 - 等待的操作过时)

    今天忽然间发现远程连接别人数据库会出现  已成功与服务器建立连接,但是在登录前的握手期间发生错误. (provider: SSL Provider, error: 0 - 等待的操作过时)  这种情况 ...

  6. SQLServer 2012 已成功与服务器建立连接,但是在登录前的握手期间发生错误。 (provider: SSL Provider, error: 0 - 等待的操作过时。

    楼主用SQL Server 2012 在连接其他电脑的实例时,一直提示“已成功与服务器建立连接,但是在登录前的握手期间发生错误. (provider: SSL Provider, error: 0 - ...

  7. 高屋建瓴 cocos2d-x-3.0架构设计 Cocos2d (v.3.0) rendering pipeline roadmap(原文)

    Cocos2d (v.3.0) rendering pipeline roadmap Why (the vision) The way currently Cocos2d does rendering ...

  8. Android进阶:七、Retrofit2.0原理解析之最简流程【下】

    紧接上文Android进阶:七.Retrofit2.0原理解析之最简流程[上] 一.请求参数整理 我们定义的接口已经被实现,但是我们还是不知道我们注解的请求方式,参数类型等是如何发起网络请求的呢? 这 ...

  9. SQLServer 2008 已成功与服务器建立连接,但是在登录前的握手期间发生错误。 (provider: SSL Provider, error: 0 - 等待的操作过时。

    在用SQL Server 2008 在连接其他电脑的实例时,一直提示“已成功与服务器建立连接,但是在登录前的握手期间发生错误. (provider: SSL Provider, error: 0 - ...

随机推荐

  1. RH133读书笔记(9)-Lab 9 Installation and System-Initialization

    Lab 9 Installation and System-Initialization Goal: Successfully install Red Hat Enterprise Linux. Sy ...

  2. HDU2647(拓扑排序+反向建图)

    题意不说了,说下思路. 给出的关系是a要求的工资要比b的工资多,因为尽可能的让老板少付钱,那么a的工资就是b的工资+1.能够确定关系为a>b,依据拓扑排序建边的原则是把"小于" ...

  3. MKNetWorkKit打印URL

    -(void)initNewUrl:(NSString *)urlString param:(NSMutableDictionary *)_paramDic{ //拼接參数至URL NSMutable ...

  4. -ms-grid -ms-grid-rows -ms-grid-row -ms-grid-columns -ms-grid-column

    style: display:-ms-grid-ms-grid-columns和-ms-grid-rows的值可以为: >标准长度单位,如像素 >对象宽度(对于列)或高度(对于行)的百分比 ...

  5. Android处理延迟加载的方法

    在项目开发,通过延时载入来实现满足我们的项目要求.那究竟如何来实现延时.以下结合java与android的相关方法来实现延时问题. 一.利用线程的Sleep方法 <span style=&quo ...

  6. IOS 在功能 autorelease release

    在一个reurn 返回值该函数里 假设,再申请为期内存(alloc 要么copy) 这次不行release  您只能使用autorelease 返回到接收在该指针后,它是由被释放!! 假设self.o ...

  7. Model绑定

    Model绑定 在前面的几篇文章中我们都是采用在URI中元数据类型进行传参,实际上ASP.NET Web API也提供了对URI进行复杂参数的绑定方式--Model绑定.这里的Model可以简单的理解 ...

  8. nettyclient异步获取数据

    源代码见,以下主要是做个重要代码记录 http://download.csdn.net/detail/json20080301/8180351 NETTYclient获取数据採用的方式是异步获取数据, ...

  9. springMVC+angular+bootstrap+mysql的简易购物网站搭建

    springMVC+angular+bootstrap+mysql的简易购物网站搭建 介绍 前端的css框架用了bootstrap, 以及bootstrap的JS组件, 以及很好用的angular(a ...

  10. react.js 从零开始(七)React (虚拟)DOM

    React 元素 React 中最主要的类型就是 ReactElement.它有四个属性:type,props,key 和ref.它没有方法,并且原型上什么都没有. 可以通过 React.create ...