Continue with the above analysis, this section to analyze cocos2dx jni part: Directory: cocos2d-x-2.1.4cocos2dxplatformandroidjniDPIJni.cppDPIJni.hIMEJni.cppIMEJni.hJava_org_cocos2dx_lib_Cocos2dxAccelerometer.cppJava_org_cocos2dx_lib_Cocos2dxBitmap.cppJava_org_c
Continue the above analysis, this section to analyze cocos2dx jni part: Directory: cocos2d-x-2.1.4 \ cocos2dx \ platform \ android \ jni DPIJni. cpp DPIJni. h IMEJni. cpp IMEJni. h too Java_org_c
Continue with the above analysis. This section analyzes the jni section of cocos2dx:
Directory:
Cocos2d-x-2.1.4 \ cocos2dx \ platform \ android \ jni
DPIJni. cpp
DPIJni. h
IMEJni. cpp
IMEJni. h
Java_org_cocos2dx_lib_Cocos2dxAccelerometer.cpp
Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp
Java_org_cocos2dx_lib_Cocos2dxBitmap.h
Java_org_cocos2dx_lib_Cocos2dxHelper.cpp
Java_org_cocos2dx_lib_Cocos2dxHelper.h
Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp
JniHelper. cpp
JniHelper. h
TouchesJni. cpp
DPIJni. cpp
Interface for obtaining screen DPI.
IMEJni. cpp
Gets the input device of the upper layer, whether to enable or disable the Input Keyboard
Java_org_cocos2dx_lib_Cocos2dxAccelerometer.cpp
One-way java call, passed to c ++, pDirector-> getAccelerometer ()-> update (x, y, z, timeStamp );
Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp
Create bitmap
Java_org_cocos2dx_lib_Cocos2dxHelper.cpp
Help class, two-way, java calls c ++ and c ++ calls java
Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp
Renderer, one-way, java passed to c ++
JniHelper. cpp
Assistance class and help Interface
TouchesJni. cpp touch screen message transmission process
Refer to the following example:
JNIEXPORT void JNICALL
Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesBegin (JNIEnv * env, jobject thiz, jint id,
Jfloat x, jfloat y ){
Cocos2d: CCDirector: sharedDirector ()-> getOpenGLView ()-> handleTouchesBegin (1,
& Id, & x, & y );
}
Passed To cocos2d-x-2.1.4 \ cocos2dx \ platform \ android CCEGLView. cpp, this class inherits
CCEGLViewProtocol, which shows the processing process
Void CCEGLViewProtocol: handleTouchesBegin (int num, int ids [], float xs [], float ys [])
This process is complete.
Here, the touch screen parser is set in CCDirector. cpp.
M_pobOpenGLView-> setTouchDelegate (m_pTouchDispatcher );
Then CCEGLViewProtocol: handleTouchesBegin
M_pDelegate-> touchesBegan (& set, NULL );
It will be here.
This section describes the communication process between JNI local code and JAVA code. Only by understanding these concepts can we
The subsequent development process is easy to use.
This section is complete.