Cocos2dx Program Structure


#1

I am having a hard time grasping the essential files needed to make an app. I can do simple edits to the Hello World example like changing text, swapping pictures and recompiling, but I don’t understand where to go next.

I am using Ubuntu with Eclipse to develop Android apps because I don’t have easy access to a mac and an iPad. However, most of the beginners’ tutorials online start in XCode and then add android support.

I am trying to understand the Paralaxer SpriteDragger app, for example. (http://paralaxer.com/cocos2d-x-tutorial/) The file structure is different than what my create-android-project.sh file creates. The cocos2dx folder is inside of a “code” folder with what looks like C*+ and Obejctive-C files mixed together. I have tried to get this app to work within the file structure the android script creates, but I can’t get it to compile.
So I gave up on that, and then I moved on to the space game example here . This one looked promising because you just drop some code into the “HelloWorld” files, but I get compile errors from that as well. Cannot find functions on lines…. I searched for the functions the compiler couldn’t find, and I couldn’t find them either. I saw on a forum post somewhere that at least one of the functions had been deprecated with a suggestion on what to use instead, but the other one I couldn’t find any info on.
So here is a list of questions I have. If you could help me with any of them I would appreciate it.

A lot of the examples I am seeing are building off of the “HelloWorld” files. Is this the way we are supposed work with Cocos2dx?
If not, what files do I need to edit to use a different jumping off point?
How do I know what functions are deprecated and how do I find what to use instead?
What order are these files supposed to be called? AppDelegate…
If I wanted to take ios projects and drop the C*+ into an android project, what goes where?

I apologize for the rambling, I just don’t know where to go to start building. Thanks in advance!


#2

“HelloWorld” is renamed and moved to “samples/cpp/HelloCpp” in the recent versions.

To create such a HelloCpp/proj.{$platform} structure, you can modify from HelloCpp as most tutorials wrote, or use my new laser weapon https://github.com/cocos2d/cocos2d-x/tree/master/tools/project-creator. The guide to this creator is [[How to create a multi-platform project in one command line]]. This feature is ready and waiting for the next version release.

For your questions:
* Starting from xcode or Visual Studio is better than eclipse, since android ndk development environment is not friendly to c++ programs
* You had to learn different mechanics of project file settings on different platforms, e.g. organize your files in android.mk on android, in xcodeproj on ios, in visual studio on windows.


#3

Zhe, you’re the man. The multi-project creator is awesome! Now I just have to figure out how these are put together. More questions to follow…