Cocos2d-x   发布时间:2022-05-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Cocos2d-x游戏开发之jsoncppdemo大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
	//json解析,使用jsoncpp

	CSJson::reader reader;
	CSJson::Value root;
	if (reader.parse(resData,root)) {
		int count = root.size();
		CCLog("count:%d",count);
		
		for (int i = 0; i < count; i++) {//使用int,否则size_t在mac在重载报错
			CSJson::Value temp = root[i];
			int id = temp["id"].asInt();
			String title = temp["title"].asString();
			
			String thumb = temp["thumb"].asString();
			getImageFromServer(thumb);

			String url = temp["url"].asString();
			CCLog("id: %d title:%s thumb:%s url:%s",id,title.c_str(),thumb.c_str(),url.c_str());
		}
	}

大佬总结

以上是大佬教程为你收集整理的Cocos2d-x游戏开发之jsoncppdemo全部内容,希望文章能够帮你解决Cocos2d-x游戏开发之jsoncppdemo所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。