[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.