当前位置: 首页>>代码示例>>C++>>正文


C++ MenuItemFont::setFontNameObj方法代码示例

本文整理汇总了C++中MenuItemFont::setFontNameObj方法的典型用法代码示例。如果您正苦于以下问题:C++ MenuItemFont::setFontNameObj方法的具体用法?C++ MenuItemFont::setFontNameObj怎么用?C++ MenuItemFont::setFontNameObj使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MenuItemFont的用法示例。


在下文中一共展示了MenuItemFont::setFontNameObj方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
开发者ID:destiny14,项目名称:FlyingSquirrel,代码行数:46,代码来源:UI.cpp

示例2: 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;
}
开发者ID:destiny14,项目名称:FlyingSquirrel,代码行数:72,代码来源:UI.cpp


注:本文中的MenuItemFont::setFontNameObj方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。