![]() ![]() PSprite->setPosition(ccp(size.width/2, size.height/2)) Place the sprite on the center of the screen Add add a splash screen, show the cocos2d splash image.ĬCSprite* pSprite = CCSprite::create("IntroScene.png") Get window size and place the label upper. add the label as a child to this Layer Menu->setPosition(ccp(size.width / 2, size.height / 2)) Menu->alignItemsVerticallyWithPadding(100) ĬCMenuItemSprite* sprite = CCMenuItemSprite::itemFromNormalSprite(question2, question, this, menu_selector(Bug458Layer::selectAnswer)) ĬCLayerColor* layer = CCLayerColor::layerWithColorWidthHeight(ccc4f(0,0,255,255), 100, 100) ĬCLayerColor* layer2 = CCLayerColor::layerWithColorWidthHeight(ccc4f(255,0,0,255), 100, 100) ĬCMenuItemSprite* sprite2 = CCMenuItemSprite::itemFromNormalSprite(layer, layer2, this, menu_selector(Bug458Layer::selectAnswer)) ĬCMenu* menu = CCMenu::menuWithItems(sprite, sprite2, NULL) QuestionContainerSprite* question2 = new QuestionContainerSprite() QuestionContainerSprite* question = new QuestionContainerSprite() You can rate examples to help us improve the quality of examples.ĬCSize size = CCDirector::sharedDirector()->getWinSize() ![]() These are the top rated real world C++ (Cpp) examples of CCMenu::alignItemsVerticallyWithPadding extracted from open source projects. C++ (Cpp) CCMenu::alignItemsVerticallyWithPadding - 30 examples found. ![]() It is a part of the Cocos2d-x game engine. Overall, the `CCMenu alignItemsVerticallyWithPadding` method is a convenient way to arrange menu items in a vertical list with a set padding. The `alignItemsVerticallyWithPadding` method is used to set a padding of 5 pixels between each score item. In this example, we create a menu with menu items generated for each high score in the `highScores` vector. ![]() ScoresMenu->alignItemsVerticallyWithPadding(5) The menu items will be arranged vertically in the center of the screen.Īnother example could be creating a list of high scores for a game:Īuto scoreLabel = Label::createWithTTF("High Score: " + score, "fonts/Marker Felt.ttf", 24) Īuto scoreItem = MenuItemLabel::create(scoreLabel) In this example, we create a menu with three items and set the padding between each item to 10 pixels. Menu->alignItemsVerticallyWithPadding(10) // Set padding of 10 It arranges menu items vertically with a set padding between each item.Īuto menu = Menu::create(item1, item2, item3, nullptr) Methods borrowed from cc.LayerRGBA: getDisplayedOpacity updateDisplayedOpacity Methods borrowed from cc.Layer: getTouchMode getTouchPriority init isAccelerometerEnabled isKeyboardEnabled isTouchEnabled onEnter onEnterTransitionDidFinish onKeyDown onKeyUp onMouseDown onMouseDragged onMouseEntered onMouseExited onMouseMoved onMouseUp onOtherMouseDown onOtherMouseDragged onOtherMouseUp onRightMouseDown onRightMouseDragged onRightMouseUp onScrollWheel onTouchesBegan onTouchesCancelled onTouchesEnded onTouchesMoved setAccelerometerEnabled setAccelerometerInterval setKeyboardEnabled setTouchEnabled setTouchMode setTouchPriority Methods borrowed from cc.The `alignItemsVerticallyWithPadding` method is a part of the `CCMenu` class in the Cocos2d-x game engine. ![]()
0 Comments
Leave a Reply. |