This game is ported from Ray Wenderlich's Cocos2dSimpleGame http://www.raywenderlich.com/352/how-to-make-a-simple-iphone-game-with-cocos2d-tutorial, which is a worldwide famous guideline for cocos2d beginners. So, special thanks to Ray Wenderlich at the start.
I show how to port cocos2d-iphone games from objc to c++ in this sample source, you can build and run it on iOS, Android, winxp/win7 & WoPhone.
Also, a series of tutorial matching this sample code are written here http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Tutorials. Each article shows the tips of language translating and multi-platform porting. These tutorials may help you to shorten your learning curve of cocos2d-x :)
This code is using cocos2d-1.0.1-x-0.9.1 stable release.
Before compilation, you need to copy these two folder: Cocos2dxSimpleGame/cocos2dx & Cocos2dxSimpleGame/CocosDenshion into Cocos2dxSimpleGame/Cocos2dxSimpleGame/libs.
Then double click Cocos2dxSimpleGame/Cocos2dxSimpleGame/Cocos2dxSimpleGameForiOS.xcodeproj to open it in xcode. Build and run it.
If you have experience on runing cocos2d-x HelloWorld on android, it will be the same to run Cocos2dxSimpleGame. If you haven't, please read this wiki http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_run_HelloWorld_on_ndk_r4_and_r5 and try.
For beginners, use android-ndk-r5 from crystax.net is recommend, which can modify as little as possible. Just modify these 2 lines
ANDROID_NDK_ROOT=/cygdrive/d/anroid/android-ndk-r5
COCOS2DX_ROOT=/cygdrive/d/Cocos2dxSimpleGame
in Cocos2dxSimpleGame/Cocos2dxSimpleGame/android/build_native.sh is enough. In commend line, run the building script
chmod 777 ./build_native.sh
./build_native.sh
After then, create an android project from the existing source, point to the folder Cocos2dxSimpleGame/Cocos2dxSimpleGame/android, clean the project to pack it, and run on emulator or device.
Double click Cocos2dxSimpleGame/cocos2d-win32.vc2008.sln, open it in VisualStudio, build and run. It's too easy.
Double click Cocos2dSimpleGame/cocos2d-wophone.sln, build and run it on wophone emulator. We haven't prepare it for wophone device, the Makefile.ARM is empty. If you wanna to, please modify Cocos2dxSimpleGameForWoPhone_Arm.TMK3 to generate Makefile.ARM, then build it.
Any bug report, any suggestion will be appreciated. Please post to forum.cocos2d-x.org to let me know.