Using Cocos2d-X

Cocos2d is not limited to iOS development. Cocos2d-X is a C++ port of Cocos2d-iPhone. Using Cocos2d-X we can develop games for many platforms including Mac, PC, Linux, Android, and more. In this recipe, we will install Cocos2d-X XCode templates, create a simple Cocos2d-X application, and introduce the Cocos2d-X testbed.

Using Cocos2d-X

Getting ready

Please refer to the project Ch8_Cocos2d-X for full working code of this recipe.

How to do it...

Execute the following code:

#include "HelloWorldScene.h" #include "SimpleAudioEngine.h" using namespace cocos2d; using namespace CocosDenshion; CCScene* HelloWorld::scene() { //'scene' is an autorelease object ...

Get Cocos2d for iPhone 1 Game Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.