在网上搜了好几个。。都是2.x的版本,不过变动不大,中文显示还是用的xml,只是API有些微变化
前面的xml文件这些步骤跟2.x版本是相同的
1.创建XML文件,如命名为CHNStrings.xml
<dict><key>language</key>
<string>English</string>
<key>username</key>
<string>我是中文1ab</string>
<key>website</key>
<string>CSDN博客:http://blog.csdn.net/jackystudio</string>
</dict>
2.使用xml文件显示中文
TTFConfig ttfConfig("Fonts\\123.ttf",25);
CCDictionary *chnStrings = CCDictionary::createWithContentsOffile("CHN_Strings.xml");
const char* username = ((CCString*)chnStrings->objectForKey("username"))->getCString(); auto labelTTF = Label::createWithTTF(ttfConfig,username); labelTTF->setcolor(color3B(255,255)); labelTTF->setposition(300,500); pLayer->addChild(labelTTF);
以上是内存溢出为你收集整理的cocos2dx 3.3显示中文全部内容,希望文章能够帮你解决cocos2dx 3.3显示中文所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)