Section 5 jni of cocos2dx

Source: Internet
Author: User
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.

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.