Cocos2d-x project porting from Win32 project to Android

Source: Internet
Author: User

1. Use vs2010 to create a Win32 project of the cocos2d-x;

2. Run the cocos2d-x under the create-android-project.bat installation directory (requires cygwin support), input the android
Package name, project name, and SDK version level;

3. Resources under the resources directory can be copied to the android Assets Directory (cocos2d-x Samples
In addition to configuring the ndk compilation information, you must copy the resources before packaging );

4. Replace the files under the Win32 classes directory with the files under the android project classes directory (ndk compilation files );

5. Copy resources in your Win32 project to the current resources (delete the redundant resources in the classes, that is, those automatically generated by the project)

6. Edit MK,

#1. Be careful! There are a lot of mk in the Android project, and the MK positions are different in different tutorials! An error occurred while editing. It is invalid. In the new engine version, Android. mk is under the JNI directory.

#2 modify the following content:

Local_src_files: add the CPP file under your classes.

Local_c_includes: add the H file of the library you are using here, if any

Local_ldlibs: add the Lib file of the library you are using here, if any

Note that third-party libraries and additional libraries must be added by yourself. The default generated MK is not that full.

7. Create an android project in eclipse. Use

Create project from existing source, which may not be identified if you are using "import.

8. Configure builder again (some configurations are described earlier );

9. Compile and run the builder project of the eclipse project;

Process extended classes from Win32 project porting to Android:

How to Use the box2d engine for coocs2d-x2.0.3x on Android:

Open the <project> \ proj. Android \ JNI \ Android. mk file,

Set local_whole_static_libraries: = cocos2dx_static cocosdenshion_static

Change to local_whole_static_libraries: = cocos2dx_static cocosdenshion_static box2d_static;

Add a sentence $ (call import-module, external/box2d)

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.