[Independent developer er Cocos2d-x practice 008] BMFont generated bitmap font tools and Cocos2dx use to load fnt files, cocos2d-xbmfont

Source: Internet
Author: User

[Independent developer er Cocos2d-x practice 008] BMFont generated bitmap font tools and Cocos2dx use to load fnt files, cocos2d-xbmfont
1, first we need to download and install BMFont tool, as follows: http://download.csdn.net/detail/chenqiai0/8899353 (there are detailed use documentation, if you do not understand what to use please leave a message ). 2. After the installation, open the BMFont interface as follows. The list on the right is the font library.3. Create a txt file and enter the text you need (Note: UTF-8 is used for saving; otherwise, the software cannot recognize it)


4. Please download the above resources and follow the steps described in pdf to export the fnt file.
Note: the path cannot contain Chinese Characters During file export. This may be because BMFont does not recognize it.
After exporting the file, you will find that there is an extra fnt file and a png file in the SAVE path (in fact, this is similar to the principle of saving the puzzle information in the plist file ), copy them to the fonts under the Resources Directory of the cocos2d-x project:
Create a Cocos2dx project and add the following code:

<Span style = "font-weight: normal;"> CCLabelBMFont * labelBmFont = CCLabelBMFont: create ("independent developer er", "fonts \. fnt "); labelBmFont-> setPosition (ccp (visibleSize. width/2, visibleSize. height-100); addChild (labelBmFont, 1); </span>


Refer to blog:
Http://blog.csdn.net/chenqiai0/article/details/46866745
Http://blog.csdn.net/keshuiyun/article/details/9960589
Http://blog.csdn.net/aa4790139/article/details/8113197
Http://blog.csdn.net/keshuiyun/article/details/9960667
Http://book.51cto.com/art/201504/473605.htm (BMFont export parameters for details refer to this blog)

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

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.