的Cocos2D-X:如何端口的Cocos2D-X项目(通过Eclipse)开发利用X code到Android?开发利用、端口、项目、Cocos2D

2023-09-05 03:46:02 作者:哥的亮瞎你的狗眼

我已经与X code进行的Cocos2D-X应用程序,它完美的作品,当我启动它从x code在iOS设备上。

I have developed a Cocos2d-X app with XCode which works perfectly when I launch it from XCode on an iOS device.

现在,我想将它移植到Android。我的理解是,我必须找到一个方法来导入我的X code计划,以便能够编译它,并启动它在Android设备上的Eclipse。

Now, I want to port it to Android. What I understand is that I have to find a way to import my "XCode project" to Eclipse in order to be able to compile it and launch it on an Android device.

我目前正在为这个项目转换为按照本教程中混合的iOS / Android项目:http://gameit.ro/2012/01/creating-an-iphone-and-android-cocos2d-x-hybrid-project-updated/#comment-640

I am currently trying to convert this project to an hybrid iOS/Android project following this tutorial: http://gameit.ro/2012/01/creating-an-iphone-and-android-cocos2d-x-hybrid-project-updated/#comment-640

不过,我不试图用build_native.sh:

Nevertheless, I don't see any of my cpp classes (cocos2d-x C++ classes) appearing in Eclipse when I open this hybrid project and I get the following errors when trying to compile it with build_native.sh:

Compile++ thumb  : game_logic <= AppDelegate.cpp
jni/../../Classes/AppDelegate.cpp:14:23: error: IntroMenu.h: No such file or directory
jni/../../Classes/AppDelegate.cpp:15:23: error: GameLayer.h: No such file or directory
jni/../../Classes/AppDelegate.cpp:16:26: error: ScoreManager.h: No such file or directory
jni/../../Classes/AppDelegate.cpp: In member function 'virtual bool AppDelegate::applicationDidFinishLaunching()':
jni/../../Classes/AppDelegate.cpp:99: error: invalid use of incomplete type 'struct ScoreManager'
jni/../../Classes/AppDelegate.h:17: error: forward declaration of 'struct ScoreManager'
jni/../../Classes/AppDelegate.cpp:101: error: invalid use of incomplete type 'struct ScoreManager'
jni/../../Classes/AppDelegate.h:17: error: forward declaration of 'struct ScoreManager'
jni/../../Classes/AppDelegate.cpp:118: error: 'GameLayer' has not been declared
jni/../../Classes/AppDelegate.cpp:120: error: 'IntroMenu' has not been declared
make: *** [obj/local/armeabi/objs-debug/game_logic/AppDelegate.o] Error 1
macbook-de-regis-andre-2:android regisandre$ ./build_native.sh

我一定要导入一些文件eclispe打?我是否需要修改一些android.mk文件?别的东西?

Do I have to import some files to Eclispe? Do I have to modify some android.mk files? Something else?

任何人都可以帮助我,或写关于这个主题的教程?谢谢!

Anybody can help me or write a tutorial on this topic? Thanks !!

推荐答案

从它您需要在创建自定义的文件添加到类看起来/ Android.mk在这样的LOCAL_SRC_FILES部分:

From the looks of it you need to add your custom created files to Classes/Android.mk in the LOCAL_SRC_FILES section like this:

LOCAL_SRC_FILES := AppDelegate.cpp \
                   HelloWorldScene.cpp \
                   IntroMenu.cpp \
                   GameLayer.cpp \
                   ScoreManager.cpp

您需要这样做是为了让Android的构建文件了解需要被包含在构建过​​程中的新文件。

You need to do this in order to let the android build file know about the new files which need to be included in the build process.

您将需要这样做,AFAIK,为您添加到项目中的每个新的源文件。

You will need to do this, afaik, for each new source file that you add to the project.

 
精彩推荐
图片推荐