在网上搜了好几个。。都是2.x的版本,不过变动不大,中文显示还是用的xml,只是api有些微变化@H_301_2@
前面的xml文件这些步骤跟2.x版本是相同的@H_301_2@
1.创建xml文件,如命名为CHNStrings.xml@H_301_2@
@H_301_2@
<dict>@H_301_2@<key>language</key>
@H_301_2@<string>English</string>
@H_301_2@<key>username</key>
@H_301_2@<string>我是中文1ab</string>
@H_301_2@<key>website</key>
@H_301_2@<string>CSDN博客:http://blog.csdn.net/jackystudio</string>
</dict>@H_301_2@
@H_301_2@TTFConfig ttfConfig("fonts\\123.ttf",25);
@H_301_2@CCDictionary *chnStrings = CCDictionary::createWithContentsOfFile("CHN_Strings.xml"); @H_301_2@
@H_301_2@const char* username = ((CCString*)chnStrings->objectForKey("username"))->@H_301_2@@H_301_2@getCString(); auto labelTTF = Label::createWithTTF(ttfConfig,username); labelTTF->setColor(Color3B(255,255)); labelTTF->setPosition(300,500); pLayer->addChild(labelTTF);@H_301_2@ @H_301_2@