O'Reilly logo

Cocos2d for iPhone 1 Game Development Cookbook by Nathan Burba

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using CCMenu

Cocos2d provides menu tools that make the process of creating a simple menu very easy. In this example, we will see how to create a simple menu, adjust menu alignment, enable/disable menu items, and more.

Using CCMenu

Getting ready

Please refer to the project RecipeCollection02 for full working code of this recipe.

How to do it...

Execute the following code:

@implementation OptionsMenu +(id) scene { //Create a scene CCScene *s = [CCScene node]; OptionsMenu *node = [OptionsMenu node]; [s addChild:node z:0 tag:0]; return s; } -(id) init { if( (self=[super init] )) { /* CODE OMITTED */ //Disabled title label for Sound option CCMenuItemFont *title1 = [CCMenuItemFont ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required