主要是编码问题,可以将中文字符串放在一个独立的utf-8文件中,然后在程序中读取。如:
将上面的代码用记事本保存为utf-8的xml文件。
在程序中读取:
auto strDic=Dictionary::createWithContentsOfFile("cnString.xml");
auto str=((String*)strDic->objectForKey("type1"))->getCString();
auto pokerTypeLabel=LabelTTF::create(str,"",50);
addChild(pokerTypeLabel);