h3. Setting up the Develop Environment
Mac OSX users can refer to:
** The best one, "Getting Started with Cocos2d-x for iOS and Android":http://www.raywenderlich.com/11283/cocos2d-x-for-ios-and-android-getting-started, written by Jean-Yves Mengant, using Xcode and Eclipse.
** "This tutorial":http://www.supersuraccoon-cocos2d.com/2011/08/10/cocos2d-x-iphone-androidide-installation-and-setup-under-mac-os/ wirtten by SuperSuRaccon also works, and it has a "video":http://www.youtube.com/watch?v=yV6Q245eK1Y on youtube
** We mostly have headache with the complication of installing Android NDK and Cygwin in NDK r6 and before, try this tutorial "How to setup Cocos2d-x (Windows and Android)":http://www.multigesture.net/articles/how-to-setup-cocos2d-x-windows-and-android/
** Since Android NDK r7, developers can build NDK source files on Windows without Cygwin, so install a windows dev env without cygwin is possible, "This blog":http://www.cnblogs.com/ybgame/archive/2012/06/07/2540693.html describe how to achieve it. Note that @ndk-gdb@ does not work on Windows, so you still need Cygwin to debug.
Linux users can
** "Develop with cocos2d-x for android on Linux":http://blog.plicatibu.com/developing-with-cocos2d-x-for-android-on-linux/ and
** "Debug it using Eclipse":http://blog.plicatibu.com/how-to-debug-cocos2d-x-and-java-code-using-eclipse/.
** But please note that linux port is only exist on cocos2d-x v1.x versions, we remove this port in v2.0
Finally, Installation and First run listed how to run HelloWorld and Test, how to create cocos2d-x project form scripts on each supported platform
h3. Concepts You Need to Know
"Cocos2d Basic Concepts":http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:basic_concepts are universally among all cocos2d branches, including cocos2d-iphone, cocos2d-x and cocos2d-html5. You can refer to cocos2d-iphone's "Programming Guide":http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:index for more details
Many developers are confused by "Standard Touch Delegate & Targeted Touch Delegate":http://www.cocos2d-iphone.org/wiki/doku.php/tips:touchdelegates?s=touch&s=delegate,
Cocos2d-x used reference count for Memory Management in Cocos2d-x. It's similar to Objective-C's NSAutoreleasePool mechanic. You should carefully use retain/release/autorelease to prevent from crashing.
h3. Step by Step Coos2dxSimpleGame Series
- Chapter 1 - How to Create a New cocos2d-x project on multi-platforms
- Chapter 2 - How to Add a sprite
- Chapter 3 - How to Move a sprite
- Chapter 4 - How to Fire some Bullets
- Chapter 5 - How to Detect the Collisions
- Chapter 6 - How to Play Music and Sound Effect
- Chapter 7 - Some Icing on the Cake
After you finished this SimpleGame series tutorial, you have managed the basic usage of cocos2d-x!
h3. Start Coding
Creating a hybrid project such as HelloWorld and Tests cannot be automatically isn't supported by IDEs such as Xcode and Visual Studio. If you need one, please refer to gmeit.ro's "Creating hybrid project":http://gameit.ro/2011/08/creating-an-iphone-and-android-cocos2d-x-hybrid-project/
You should know some platform limitations when writing a multi-platform game
** Audio formats supported by CocosDenshion on different platforms
** Max size of textures in cocos2d-x depends on each platform
** How does function fullPathFromRelativePath in class CCFileUtils work
** How to save read file on different platforms
** Best Practice of cross-platform games
You should know How to use jni if you want to wrap android sdk APIs to C++. It's VERY IMPORTANT !
Work with CocosBuilder will speed up your development evidently.
Integrating 3rd party SDK
** OpenFeint, you can refer to "MolioApp's Blog":http://blog.molioapp.com/2011/11/openfeint-and-admob-integrated-with.html
** Game Center, please read "this thread":http://www.cocos2d-x.org/boards/6/topics/6891
** Flurry Analytics wrapper "AnalyticX":http://www.cocos2d-x.org/projects/cocos2d-x/assets/7 written by Diwu (Zynga China), or "integration sample code":http://www.cocos2d-x.org/boards/6/topics/8518 written by Dmitry Matyukhin
** "Scoreloop wrapper":http://www.cocos2d-x.org/projects/cocos2d-x/assets/9 written by Marat Yakupov
"Integrate cocos2d-x opengl views into an UIViewController on iOS / UIKit":http://jpsarda.tumblr.com/post/24983791554/mixing-cocos2d-x-uikit
"Integrate cocos2d-x activities into a classic Java Android application":http://jpsarda.tumblr.com/post/26000816688/integrate-cocos2d-x-c-into-an-android-application
Maybe you would like to "Play a video on iOS under cocos2d-x":http://www.cocos2d-x.org/boards/7/topics/550
Work with Box2D
** "How to use Box2D for just Collision Detection with cocos2d-x":http://www.gmtdev.com/blog/2011/08/19/how-to-use-box2d-for-just-collision-detection-with-cocos2d-x/ by Gav T
** "How to Make a Catapult Shooting Game with cocos2d-x and box2d":http://www.cocos2d-x.org/boards/6/topics/4391 by Mac Andy
h2. Code Examples
** Scrolling scenes, using CCParallaxNode, refer to "Space game example":http://www.raywenderlich.com/11338/cocos2d-x-for-ios-and-android-space-game on raywenderlich.com
** "InfiniteParallax Class":https://github.com/jasonmarziani/CCParallaxScrollNode, to repeat same backgrounds all time.
** "Slider code":http://www.cocos2d-x.org/boards/6/topics/9803 and its "video":https://www.youtube.com/watch?*v=hvQOnk4RgmM. If you're using v2.0 and higher version, I suggest you to use extensions/CCControlExtension/CCControlSlider
** "Split Screen using 2 layers":http://blog.bigbunkerstudio.com/?p=154
** "Sharped Label TTF":https://rombosblog.wordpress.com/2012/04/11/prevent-blurry-fonts-when-using-cclabelttf/, better labels
** Simple Game Series "Part1":https://github.com/clawoo/SimpleGameCocos2D-x, "Part2":https://github.com/clawoo/SimpleGamePart2Cocos2D-x, "Part3":https://github.com/clawoo/SimpleGamePart3Cocos2D-x
** "Cute a pult":https://github.com/clawoo/CuteAPultCocos2D-x
** "TileBased Game":https://github.com/clawoo/TileBasedGameCocos2D-x
Samsung Bada's official sample:
** "Ballon Ride":http://developer.bada.com/library/BalloonRide
** Space Shooter Episode, "Part1":http://developer.bada.com/library/Space-Shooter-Episode-I-How-to-start-development-with-Cocos2d-x, "Part2":http://developer.bada.com/library/Space-Shooter-Episode-II-How-to-move-things
Wudi (Zynga China)'s sample "Tiny Wings Remake on Android using Cocos2d-X":https://github.com/diwu/Tiny-Wings-Remake-on-Android
"TweeJump port":http://www.cocos2d-x.org/boards/6/topics/1652 by Francis Styck
Chris Wong's "BTris":http://www.cocos2d-x.org/boards/6/topics/322 is recently updated to cocos2d-x 1.0.1