Cocos2dx Chinese font display method Hiero

Source: Internet
Author: User

In games, we often encounter the need to display a large Chinese conversation. In this case, we need to load some custom Chinese character formats and generate a pile of pictures directly from the art, which is too memory-consuming for mobile phones, at this time, hiero came into being.

Hiero can generate png and tnf files in specific fonts for all characters, and program code in the program to display rich and colorful man content.

1. hiero download link: http://download.csdn.net/detail/u010229677/6992501

2. hiero usage


<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + 1 + 6687Wlu/fOxLz + vLS/ybGjtOZwbmejrDwvcD4KPHA + signature/Signature/Co7o8L3A + signature "brush: java;"> Women We Dajia Everybody Pengyou Friend

In this way, each Chinese field has a key, which can be used to obtain Chinese characters.

2. Code Implementation

CCDictionary *strings =CCDictionary::createWithContentsOfFile("one.xml");      const char *charwomen= ((CCString*)strings->objectForKey("women"))->m_sString.c_str();         CCLabelBMFont* labelFont =CCLabelBMFont::create(charchinese, "one.fnt");     labelFont->setPosition(ccp(100,100));     addChild(labelFont);

Then we can display our defined "we ".


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.