【文件属性】:
文件名称:cocos2d-x 读取xml
文件大小:6KB
文件格式:ZIP
更新时间:2016-07-18 03:56:24
12
在cocos2d-x 中读取xml文件
用法:
XMLParser *pXmlParser = XMLParser::parseWithFile("strings.xml");
CCString *pValue1 = pXmlParser->getString("hello");
CCString *pValue2 = pXmlParser->getString("name");
CCString *pValue = CCString::createWithFormat("%s%s%s%s", "XML: ", pValue1->getCString(), ",", pValue2->getCString());
CCLabelTTF* pLabel = CCLabelTTF::create( TextUtil::a2u(pValue->getCString()).c_str() , "Arial", 30);
pLabel->setColor(ccGREEN);
pLabel->setPosition(ccp(size.width / 2, size.height - 30));
this->addChild(pLabel, 1);
【文件预览】:
cocos2d-x_xml
----XmlParser.h(1KB)
----TakeoffScene.cpp(10KB)
----TakeoffScene.h(1KB)
----XmlParser.cpp(3KB)
网友评论
- 学习了,可以使用
- 还行吧,就是有点麻烦
- 不错,很好的例子,谢谢楼主分享,谢谢
- 不错 cocos2d-x2.2的也可以直接使用
- 不错,很好的例子,谢谢楼主分享,谢谢
- 用起来挺方便的