Cocos2d-x cross-platform features for iOS to Android

Source: Internet
Author: User

In learning coco2d-x found that, or in xcode write code and debugging is more convenient, but after writing how to transplant to Android, generate APK? It's easy, just a few steps.

1. Complete the game project in xcode.

2. Generate the android Project (to use the command line, the coco2d-x official website has the steps to generate the android project ).

3. Copy all the resource files used by the IOS project to the resource folder of the android project, and copy all the code files to the classes folder.

4. Modify Android. mk in the jni folder of the android project.

Android. mk:

For example, you should have only main. cpp \
.../../Classes/appdelegate. cpp \
.../../Classes/helloworldscene. cpp

Add new. cpp
Main. cpp \
.../../Classes/appdelegate. cpp \
../Classes/helloworldscene. cpp \
../Classes/xxx1.cpp \
../Classes/xxx2.cpp \
../Classes/xxx3.cpp


5. Use the command line to call build_native.sh (my Mac, so it is SH) in the android project for compilation.

6. After compilation is complete, import and modify the project in eclipse and compile and run the project. The android game APK is generated successfully.

Note: If the underlying C ++ code is modified, you only need to recompile the underlying library and compile and run it in eclipse.

Related Article

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.