In cocos2d x for windows ccmenu is almost same as that in normal cocos2d.
Here is a sample code. We can add two items in the menu:menuItem1 and menuItem2.
|
1 2 3 |
CCMenuItemSprite menuItem1 = CCMenuItemSprite.itemFromNormalSprite(in1, in2, this, new SEL_MenuHandler(informationAction)); CCMenuItemSprite menuItem2 = CCMenuItemSprite.itemFromNormalSprite(in3, in4, this, new SEL_MenuHandler(buttonAction)); |
In the above code, in1 and in3 are normal sprites and in2 and in4 are selected sprite.Next parameter this is the target. and buttonAction and the informationAction are touch functions.
|
1 |
CCMenu menu1 = CCMenu.menuWithItems(menuItem1, menuItem2); |
Now we create the ccmenu menu1 with the above menuItems.
Filed under: Cocos2d x • Objective C • Windows Phone 7
Like this post? Subscribe to my RSS feed and get loads more!




Leave a Reply