WinSize = CCDirector::sharedDirector()->getWinSize() ĬCSprite* sl = CCSprite::create(s_loading) ĬCSprite* logo = CCSprite::create(s_logo) It’s almost as if the tempMenu object is being rendered as if it had zero content size.Jieyaozu/FightingSolarSystem // on "init" you need to initialize your instanceĬCTexture2D *shipTexture = CCTextureCache::sharedTextureCache()->addImage(s_ship01) ĬostomeKeyPadDelegae *keyDelegate = new CostomeKeyPadDelegae() ĬCDirector::sharedDirector()->getKeypadDispatcher()->addDelegate(keyDelegate) I have checked the anchors and content sizes of the menus and they are all being set correctly, but for some reason, when it comes to the actual rendering, the anchor point doesn’t seem to make a difference. MainMenu->alignItemsVerticallyWithPadding(20.0f) ĬCMenuPassive is almost identical to CCMenu, but it’s necessary to set the content size of the menu itself to the correct size (instead of defaulting to the screen size, as is done in CCMenu). MainMenu->setPosition(currentMenuPosition) MainMenu = CCMenuPassive::menuWithItems(quickPlayButton, customGameButton, optionsButton, temp, NULL) TempMenu->setIsRelativeAnchorPoint(true) TempMenu->setAnchorPoint(ccp(0.0f, 0.5f)) OptionsButton->setAnchorPoint(ccp(0.0f, 0.5f)) QuickPlayButton->setAnchorPoint(ccp(0.0f, 0.5f)) ĬustomGameButton->setAnchorPoint(ccp(0.0f, 0.5f)) TempMenu->alignItemsHorizontallyWithPadding(0) OptionsButton=standardButtonWithTitle(“Options”) ĬCMenuPassive* tempMenu=CCMenuPassive::menuWithItems( standardButtonWithTitle(“1”), standardButtonWithTitle(“2”), standardButtonWithTitle(“3”), standardButtonWithTitle(“4”), NULL) `quickPlayButton=standardButtonWithTitle(“Quick Play”) ĬustomGameButton=standardButtonWithTitle(“Custom Game”) No matter what I try, I can’t get it to align properly. However, I’ve tried setting the anchors of all of the menu items (and the sub-menu) and the result is this: Īll the items are now correctly justified, except for the row that is made up of a set of horizontally aligned controls. You can see an example of this working perfectly for centre aligned menus at I have been trying to create a vertically aligned menu that is left-aligned and includes sub items that are themselves horizontally aligned menus.
0 Comments
Leave a Reply. |