文件名称: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)