COCOS2DX---Displaying HTML pages in the game

Source: Internet
Author: User

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.


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.