本文整理汇总了C++中MenuItemLabel::getBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C++ MenuItemLabel::getBoundingBox方法的具体用法?C++ MenuItemLabel::getBoundingBox怎么用?C++ MenuItemLabel::getBoundingBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuItemLabel
的用法示例。
在下文中一共展示了MenuItemLabel::getBoundingBox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showPauseMenu
void BScene::showPauseMenu()
{
//pause game and input
Director::getInstance()->pause();
playerLayer->stopMovement();
keyHandler->disableByReceiver(playerLayer);
Size windowSize = Director::getInstance()->getWinSize();
overlay = new OverLayer();
//create menu
Menu* pMenu = Menu::create();
//create menu items
const Point origin = Director::getInstance()->getVisibleOrigin();
MenuItemLabel* title;
MenuItemLabel* exitGame;
MenuItemLabel* levelSelect;
MenuItemLabel* resume;
//set up Main menu item
resume = MenuItemLabel::create(LabelTTF::create("Resume", "Arial", 20),
BScene::resumeCB);
resume->setPosition(0,0);
pMenu->addChild(resume);
//set up Snake Mode item
levelSelect = MenuItemLabel::create(LabelTTF::create("Level Select", "Arial", 20),
BScene::levelSelectCB);
levelSelect->setPosition(0, resume->getPosition().y + resume->getContentSize().height+10);
pMenu->addChild(levelSelect);
//set up Standard Mode item
exitGame = MenuItemLabel::create(LabelTTF::create("Exit Game", "Arial", 20),
BScene::exitGameCB);
exitGame->setPosition(0, levelSelect->getPosition().y + levelSelect->getContentSize().height+10);
pMenu->addChild(exitGame);
//set up Title item
title = MenuItemLabel::create(LabelTTF::create("Pause Menu", "Arial", 30));
title->setPosition(0, exitGame->getPosition().y + exitGame->getContentSize().height+20);
pMenu->addChild(title);
//center the menu
float heightofitems = exitGame->getBoundingBox().getMaxY() - resume->getBoundingBox().getMinY();
pMenu->setPosition(origin.x + windowSize.width/2,
origin.y + windowSize.height/2 - heightofitems/2);
overlay->initWithColorMenu( Color4B(0,0,0,150), pMenu);
addChild(overlay,4);
layerFocus = 1;
overlay->release();
}