![]() Option->setScaleX(winSize.width/(option->getContentSize().width*4)) Title->setPosition(ccp(winSize.width/2, (13*winSize.height)/16)) ĬCSprite *option = CCSprite::create("options.png") Title->setScaleY((winSize.height)/(title->getContentSize().height*4)) ![]() create title, set scale, set position, add titleĬCSprite *title = CCSprite::create("bb.png") -add sprites: title, author, option, and beginĬCSize winSize = CCDirector::sharedDirector()->getWinSize() ĬCSprite *author = CCSprite::create("author.png") Īuthor->setScaleX((3*winSize.width)/(author->getContentSize().width*8)) Īuthor->setScaleY(winSize.height/(author->getContentSize().height*8)) Īuthor->setPosition(ccp(winSize.width/2, (5*winSize.height)/8)) Se->addEventListener(this, callfunc_selector(SlotEffectTest::selectSpt)) ĬCMenuItemLabel* randomItem = CCMenuItemLabel::create(CCLabelTTF::create("randomBtn", "Arial", 30), this, menu_selector(SlotEffectTest::randomClick)) ĬCMenuItemLabel* item = CCMenuItemLabel::create(CCLabelTTF::create("startBtn", "Arial", 30), this, menu_selector(SlotEffectTest::itemClick)) ĬCMenu* menu = CCMenu::create(randomItem, item, NULL) StartY -= spt->getContentSize().height + gap MenuMainMenu->setPosition(Utils::getCorrectPosition(0.5,0.26)) Īnim->setPosition(Utils::getCorrectPosition(0,1)) Īnim->initAnim(0,0,1,0,0.2f,0,0.2f,0,0,0) įor (int i = 1 i setPositionX((startX + gap + spt->getContentSize().height) * index) MenuContinue->setPosition(Utils::getCorrectPosition(0.5,0.5)) ![]() Pause->setPosition(Utils::getCorrectPosition(0.5,0.8)) SpriteWithText *pause = SpriteWithText::createWithSpriteFrameNamee("onButton.png","PAUSED",ccColor3B) ĬCSprite *resumeOn = CCSprite::createWithSpriteFrameName("onPaused.png") ĬCSprite *resumeOff = CCSprite::createWithSpriteFrameName("offPaused.png") ĬCSprite *goBackOn = CCSprite::createWithSpriteFrameName("goBackOn.png") ĬCSprite *goBackOff = CCSprite::createWithSpriteFrameName("goBackOff.png") ĬCMenuItemSprite *restartBtn = CCMenuItemSprite::create(goBackOn, goBackOff, this, menu_selector(Pause::restartGame)) ĬCMenuItemSprite *resumeBtn = CCMenuItemSprite::create(resumeOn,resumeOff,this,menu_selector(Pause::toggle)) ĬCMenuItemSprite *mainMenuBtn = CCMenuItemSprite::create(mainMenuOn,mainMenuOff,this,menu_selector(Pause::goToMainMenu)) ĬCMenu *menuContinue = CCMenu::create(restartBtn,resumeBtn,NULL) ĬCMenu *menuMainMenu = CCMenu::create(mainMenuBtn,NULL) You can rate examples to help us improve the quality of examples. ![]() These are the top rated real world C++ (Cpp) examples of CCMenu::alignItemsHorizontally extracted from open source projects. C++ (Cpp) CCMenu::alignItemsHorizontally - 19 examples found. The package library for CCMenu and other Cocos2d-x classes is included in the Cocos2d-x game engine itself. In the above code, we have created a menu with three items and aligned them horizontally with a padding of 100 pixels between each item. Menu->alignItemsHorizontallyWithPadding(100) In the above code, we have created a menu with three items and aligned them horizontally using the alignItemsHorizontally method. Here is an example code snippet that demonstrates the use of CCMenu alignItemsHorizontally property:Īuto menu = CCMenu::create(item1, item2, item3, NULL) The alignItemsHorizontally property in CCMenu is used to align the child menu items horizontally. CCMenu is a part of Cocos2d-x game engine which is used for creating games and interactive applications.
0 Comments
Leave a Reply. |