+(CCScene *) scene
{
CCScene *scene = [CCScene node];
HelloWorldLayer *layer = [HelloWorldLayer node];
CCSprite *background=[CCSprite spriteWithFile:@"Default.png"];
background.anchorPoint=ccp(0, 0);
[layer addChild:background z:-1 ];
[scene addChild: layer];
return scene;
}
-(void)menuItem1Select:(id)item{
NSLog(@"menuitem1,Select");
}
-(void)menuItem2Select:(id)item{
NSLog(@"menuitem2,Select");
}
-(id) init
{
if( (self=[super init]) ) {
/**
CCMenuItemImage *menuitem1 = [CCMenuItemImage itemWithNormalImage:@"head.png" selectedImage:@"bird.png" target:self selector:@selector(menuItem1Select:)];
[menuitem1 setScale:0.1];
CCMenuItemImage *menuitem2 = [CCMenuItemImage itemWithNormalImage:@"head.png" selectedImage:@"bird.png" target:self selector:@selector(menuItem2Select:)];
[menuitem2 setScale:0.1];
CCMenu *menu=[CCMenu menuWithItems:menuitem1,menuitem2,nil];
**/
CCMenuItemFont *menuitem1 = [CCMenuItemFont itemWithString:@"select one" target:self selector:@selector(menuItem1Select:)];
CCMenuItemFont *menuitem2 = [CCMenuItemFont itemWithString:@"select two" target:self selector:@selector(menuItem2Select:)];
CCMenu *menu=[CCMenu menuWithItems:menuitem1,menuitem2,nil];
[menu alignItemsVerticallyWithPadding:5];
[self addChild:menu];
}
return self;
}