add menutogglebutton in cocos2d-x

add menutogglebutton in cocos2d-x
0.0 0


i want to add menu toggle button for sound on off in my scene… help me….i cant it like cocos2d……


You can try something like this:

CCMenu* pMenu = CCMenu::create(); pMenu->setPosition(CCPointZero); this->addChild(pMenu, 1); CCMenuItemSprite* p1 = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("btn.png"), CCSprite::createWithSpriteFrameName("btn_down.png")); CCMenuItemSprite* p2 = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("btn_down.png"), CCSprite::createWithSpriteFrameName("btn.png")); CCMenuItemToggle* pToggle = CCMenuItemToggle::createWithTarget(this, menu_selector(Main::btnCallback), p1, p2, NULL); pToggle->setPosition(100.0f, 100.0f); pMenu->addChild(pToggle);


For radio buttons ( a group of menu items, where only one is in ‘pressed’ state), is there a component ready for that?