Cocos2dx + libevent library, cocos2dxlibevent Library
Path: $ path = cocos2dx/platform/third_party
1. win32
Put the generated libevent_core.lib and libevent_extras.lib in $ path/win32/libraries.
Put the header file event2 and the event-config.h in $ path/win32/libevent.
Set include path and add lib in
2. ios
Generate the library file (libevent_core.a, libevent_extra.a, libevent_pthreads.a) for the IOS platform and put it in $ path/ios/libraries. Note: it is the library file for IOS, not for linux.
Put the header file in $ path/ios/libevent
Add head search path and the three library files in xcode.
The library file is also generated using the libevent OnionBrowser.
3. android
Android is so difficult that it takes a long time to complete it.
Problem list
1). logcat output debugging: Add LOCAL_CFLAGS: =-DCOCOS2D_DEBUG = 1 to proj. android/jni/andoird. mk.
2) during the ndk build process, the system prompts that htons could not be found. After checking for a long time, we found that the custom endian. h and system file were renamed.
3). After the buffer is added, bufferevent_socket_connect returns-1, and the connection fails.
The reason is that you do not have the network permission. Add the permission application in proj. android/AndroidManifest. xml
<Uses-permission android: name = "android. permission. INTERNET"> </uses-permission>
4) after the ndk build is complete, the connection fails. Some library functions cannot be found because the libevent is being built. a comments a section. The link character "\" is used to comment out all the following sections,
The libevent. Package is incomplete.
Add Library: on the internet, git finds a libevent for andoird, build it with ndk, and put it in $ path/android/libevent. The. mk file is written in the same way as libcurl.
Link: https://github.com/ventureresearch/libevent/tree/master
Then add LOCAL_STATIC_LIBRARIES + = cocos_event_static in proj. android/jni/andoird. mk;
$ (Call import-module, cocos2dx/platform/third_party/android/prebuilt/libevent)