本文整理汇总了C++中MenuItemFont::setFontSizeObj方法的典型用法代码示例。如果您正苦于以下问题:C++ MenuItemFont::setFontSizeObj方法的具体用法?C++ MenuItemFont::setFontSizeObj怎么用?C++ MenuItemFont::setFontSizeObj使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuItemFont
的用法示例。
在下文中一共展示了MenuItemFont::setFontSizeObj方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createLevelEditorFilePopup
void UI::createLevelEditorFilePopup()
{
Size visibleSize = Director::getInstance()->getVisibleSize();
MenuItemFont* addTextureObject = MenuItemFont::create("choose file", CC_CALLBACK_0(UI::nullCallback, this));
addTextureObject->setFontNameObj("Segoe UI");
addTextureObject->setFontSizeObj(34);
addTextureObject->setPosition(visibleSize.width * 0.5f, visibleSize.height - 30);
MenuItemFont* scrollUpObject = MenuItemFont::create("up", CC_CALLBACK_0(LevelEditor::moveFileSelectUpCallback, pLevelEditor));
scrollUpObject->setFontNameObj("Segoe UI");
scrollUpObject->setFontSizeObj(34);
scrollUpObject->setPosition(visibleSize.width - 50, visibleSize.height - 30);
MenuItemFont* scrollDownObject = MenuItemFont::create("down", CC_CALLBACK_0(LevelEditor::moveFileSelectDownCallback, pLevelEditor));
scrollDownObject->setFontNameObj("Segoe UI");
scrollDownObject->setFontSizeObj(34);
scrollDownObject->setPosition(visibleSize.width - 50, 30);
MenuItemImage* scrollBackground = MenuItemImage::create("Resources/pictures/generic/ui_background.png", "ui_background.png", CC_CALLBACK_0(UI::nullCallback, this));
scrollBackground->setPosition(visibleSize.width * 0.5f, visibleSize.height * 0.5f);
scrollBackground->setScale(400, visibleSize.height);
int paddingTop = 60;
Vector<MenuItem*> lMenuItems;
lMenuItems.pushBack(addTextureObject);
for (string s : getAllFilesInFolder("Resources/pictures/tiles"))
{
MenuItemFont* menuItem = MenuItemFont::create(s, CC_CALLBACK_1(LevelEditor::chooseFileCallback, pLevelEditor, s, levelType));
menuItem->setFontNameObj("Segoe UI");
menuItem->setFontSizeObj(24);
menuItem->setPosition(visibleSize.width * 0.5f, visibleSize.height - paddingTop);
paddingTop += 30;
lMenuItems.pushBack(menuItem);
}
auto menu = Menu::createWithArray(lMenuItems);
auto scrollMenu = Menu::create(scrollBackground, scrollDownObject, scrollUpObject, NULL);
scrollMenu->retain();
scrollMenu->setPosition(0, 0);
menu->retain();
menu->setPosition(0, 0);
m_pLevelEditor->addChild(menu);
m_pLevelEditor->addChild(scrollMenu, -10);
pLevelEditor->ChooseFileMenu = menu;
pLevelEditor->ChooseFileNavMenu = scrollMenu;
}
示例2: onLoadScene
void MenuScene::onLoadScene()
{
m_vMenuItems.push_back("Basic Test");
Size tContainerSize = Size(700, 100 * m_vMenuItems.size());
Layer* pScrollViewContainer = Layer::create();
pScrollViewContainer->setPosition(Point::ZERO);
pScrollViewContainer->setContentSize(tContainerSize);
m_pScrollView = ScrollView::create(Size(700, 640));
m_pScrollView->ignoreAnchorPointForPosition(false);
m_pScrollView->setPosition(CCPoint(480, 320));
m_pScrollView->setContainer(pScrollViewContainer);
addChild(m_pScrollView);
Vector<MenuItem *> vet;
float height = tContainerSize.height;
unsigned int i = 0;
unsigned int end = m_vMenuItems.size();
for(; i < end; ++i )
{
MenuItemFont* pFont = MenuItemFont::create(m_vMenuItems[i].c_str());
pFont->setCallback(CC_CALLBACK_1(MenuScene::onClick,this));
pFont->setFontSizeObj(45.0f);
pFont->setPosition(Point(700 / 2, height - 100 / 2));
pFont->setTag(i + 1);
vet.pushBack(pFont);
height -= 100;
}
Menu* pMenu = Menu::createWithArray(vet);
pMenu->setPosition(Point(0,0));
pScrollViewContainer->addChild(pMenu);
m_pScrollView->setContentOffset(Point(0, -(tContainerSize.height - 640)));
}
示例3: createLevelEditorUI
void UI::createLevelEditorUI()
{
Size visibleSize = Director::getInstance()->getVisibleSize();
auto labelMenuTitle = LabelTTF::create("Level Editor", "Segoe UI", 12);
labelMenuTitle->setPosition(35.0f, visibleSize.height - 40.0f);
m_pLevelEditor->addChild(labelMenuTitle);
MenuItemImage* sidebarBackground = MenuItemImage::create("Resources/pictures/generic/ui_background.png", "ui_background.png", CC_CALLBACK_0(UI::nullCallback, this));
sidebarBackground->setPosition(100.0f, visibleSize.height * 0.5f);
sidebarBackground->setScale(200, visibleSize.height);
MenuItemFont* addTextureObject = MenuItemFont::create("add texture", CC_CALLBACK_1(LevelEditor::addTextureObjectCallback, pLevelEditor));
addTextureObject->setFontNameObj("Arial");
addTextureObject->setFontSizeObj(30);
addTextureObject->setPosition(80.0f, visibleSize.height - 80.0f);
MenuItemFont* addGroundObject = MenuItemFont::create("add ground", CC_CALLBACK_1(LevelEditor::addGroundObjectCallback, pLevelEditor));
addGroundObject->setFontNameObj("Arial");
addGroundObject->setFontSizeObj(30);
addGroundObject->setPosition(80.0f, visibleSize.height - 120.0f);
MenuItemFont* addNutObject = MenuItemFont::create("add nut", CC_CALLBACK_1(LevelEditor::addNutObjectCallback, pLevelEditor));
addNutObject->setFontNameObj("Arial");
addNutObject->setFontSizeObj(30);
addNutObject->setPosition(80.0f, visibleSize.height - 160.0f);
MenuItemFont* addCrystalObject = MenuItemFont::create("add crystal", CC_CALLBACK_1(LevelEditor::addCrystalObjectCallback, pLevelEditor));
addCrystalObject->setFontNameObj("Arial");
addCrystalObject->setFontSizeObj(30);
addCrystalObject->setPosition(80.0f, visibleSize.height - 200.0f);
MenuItemFont* addAirObject = MenuItemFont::create("add aircurrent", CC_CALLBACK_1(LevelEditor::addAirObjectCallback, pLevelEditor));
addAirObject->setFontNameObj("Arial");
addAirObject->setFontSizeObj(30);
addAirObject->setPosition(80.0f, visibleSize.height - 240.0f);
MenuItemFont* changeLayerObject = MenuItemFont::create("mainLayer", CC_CALLBACK_0(LevelEditor::changeLayerCallback, pLevelEditor));
changeLayerObject->setFontNameObj("Arial");
changeLayerObject->setFontSizeObj(30);
changeLayerObject->setPosition(73.0f, visibleSize.height - 280.0f);
changeLayerObject->setTag(111);
MenuItemFont* toggleGrid = MenuItemFont::create("snap to grid", CC_CALLBACK_0(LevelEditor::toggleGridCallback, pLevelEditor));
toggleGrid->setFontNameObj("Arial");
toggleGrid->setFontSizeObj(30);
toggleGrid->setPosition(80.0f, visibleSize.height - 320.0f);
toggleGrid->setTag(112);
MenuItemFont* toggleSelectionMode = MenuItemFont::create("selection", CC_CALLBACK_0(LevelEditor::toggleSelectionMode, pLevelEditor));
toggleSelectionMode->setFontNameObj("Arial");
toggleSelectionMode->setFontSizeObj(30);
toggleSelectionMode->setPosition(80.0f, visibleSize.height - 360.0f);
toggleSelectionMode->setTag(113);
MenuItemFont* saveLevelObject = MenuItemFont::create("save level", CC_CALLBACK_0(LevelEditor::saveLevelCallback, pLevelEditor));
saveLevelObject->setFontNameObj("Arial");
saveLevelObject->setFontSizeObj(30);
saveLevelObject->setPosition(70.0f, visibleSize.height - 400.0f);
MenuItemFont* mainMenuObject = MenuItemFont::create("Mainmenu", CC_CALLBACK_0(LevelEditor::mainMenuCallback, pLevelEditor));
mainMenuObject->setFontNameObj("Arial");
mainMenuObject->setFontSizeObj(30);
mainMenuObject->setPosition(70.0f, visibleSize.height - 440.0f);
auto menu = Menu::create(addTextureObject, addGroundObject, addNutObject, addCrystalObject, addAirObject, changeLayerObject, toggleSelectionMode, saveLevelObject, toggleGrid, mainMenuObject, NULL);
auto menuBackground = Menu::create(sidebarBackground, NULL);
menuBackground->setPosition(0, 0);
menu->setPosition(0, 0);
m_pLevelEditor->addChild(menu);
m_pLevelEditor->addChild(menuBackground, -10);
pLevelEditor->MainMenu = menu;
}