This article describes the simple rich-text component RichText, and now we have a look at the third-party components made by the FreeType library, which can display HTML pages directly, and be able to implement hyperlinks and touch things.
Steps:
1. In GitHub download, address and then paste: https://github.com/happykevins/cocos2dx-ext, download this project, github download the way Baidu itself.
2. The files that will be downloaded cells, Dfont, and extensions below the directory. Richcontrols These three folders and the renren-ext.h header file is copied into the cocos2dx2.2.3 directory with the same name extensions below.
3. Compare the android.mk files below the two directories and merge some of the contents of the downloaded Android.mk file into cocos2dx2.2.3\extensions\android.mk.
<span style= "White-space:pre" ></span>./dfont/dfont_utility.cpp/dfont/dfont_render.cpp./dfont/dfont _manager.cpp./richcontrols/cchtmllabel.cpp./richcontrols/ccrichatlas.cpp./richcontrols/ccrichcache.cpp. Richcontrols/ccrichcompositor.cpp./richcontrols/ccrichelement.cpp./richcontrols/ccrichnode.cpp./RichControls/ CCRichOverlay.cpp./richcontrols/ccrichparser.cpp./cells/ccell.cpp./cells/ccells.cpp./cells/ CCreationFactory.cpp./cells/ccreationworker.cpp./cells/cdownloader.cpp./cells/cutils.cpp./cells/cells.cpp. cells/md5.c./cells/zpip.clocal_whole_static_libraries + = cocos_freetype2_static$ (call import-module,cocos2dx/ Platform/third_party/android/prebuilt/libfreetype2
4, will download the file in the cocos2dx-ext-master\cocos2dx\platform\third_party\android\prebuilt the following libfreetype2 folder copied to local cocos2dx2.2.3 the corresponding location.
5, compile, reference Cocos2dx-ext-master\samples
Advantages:
The HTML file can be loaded directly to handle click events.
Disadvantages:
This is the source code provided on GitHub, the implementation is more complex, not guaranteed stability, the BUG needs to be modified by itself.