本文整理汇总了C++中MenuItemFont::setLabel方法的典型用法代码示例。如果您正苦于以下问题:C++ MenuItemFont::setLabel方法的具体用法?C++ MenuItemFont::setLabel怎么用?C++ MenuItemFont::setLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuItemFont
的用法示例。
在下文中一共展示了MenuItemFont::setLabel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setConfirm
void TutorialScene::setConfirm()
{
const int maxNumMonsters = 3;
const int maxNumEquip = 10;
if (Generic::checkSaveData())//If there is data - Display confirmation menu to reset it
{
auto confirmText = Label::createWithTTF("データを消してもよろしいですか", "fonts/ant-maru.ttf", 45);
confirmText->enableOutline(Color4B::WHITE, 2);
confirmText->setPosition(Vec2(visibleSize.width / 2, visibleSize.height / 1.5));
this->addChild(confirmText);
MenuItemFont::setFontSize(60);
MenuItemFont* yesItem = MenuItemFont::create("YES", CC_CALLBACK_1(TutorialScene::menuSceneTransition, this));
MenuItemFont* noItem = MenuItemFont::create("NO", CC_CALLBACK_1(TutorialScene::rtrnTitleScene, this));
auto label1 = Label::createWithTTF("はい", "fonts/ant-maru.ttf", 45);
auto label2 = Label::createWithTTF("いいえ", "fonts/ant-maru.ttf", 45);
label1->enableOutline(Color4B::WHITE, 2);
label2->enableOutline(Color4B::WHITE, 2);
yesItem->setLabel(label1);
noItem->setLabel(label2);
confirmMenu = Menu::create(yesItem, noItem, NULL);
confirmMenu->setPosition(Vec2(visibleSize.width / 2, visibleSize.height / 3));
confirmMenu->alignItemsVerticallyWithPadding(30);
this->addChild(confirmMenu);
}
else
{
/*
resetSaveData();
auto listener = EventListenerTouchOneByOne::create();
listener->setSwallowTouches(true);
listener->onTouchBegan = [](Touch* touch, Event* event)
{
return true;
};
listener->onTouchEnded = [](Touch* touch, Event* event)
{
auto nextScene = MenuScene::createScene();
auto pScene = TransitionFade::create(1.0f, nextScene);
Director::getInstance()->replaceScene(MenuScene::createScene());
CCLOG("Test");
};
this->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, this);
*/
auto tmpNode = Node::create();
auto transition = CallFunc::create([this](){this->continueToMenu(); });
tmpNode->runAction(transition);
}
}
示例2: displayBG
void TitleScene::displayBG()
{
auto wall = DrawNode::create();
wall->drawSolidRect(Vec2(0, 0), Vec2(m_visibleSize.width, m_visibleSize.height), Color4F::WHITE);
this->addChild(wall);
auto title = Sprite::create("img/title.png");
// position the sprite on the center of the screen
title->setScale(m_visibleSize.width / m_visibleSize.height);
title->setPosition(Point(m_visibleSize.width / 2, m_visibleSize.height / 1.3));
// add the sprite as a child to this layer
this->addChild(title);
MenuItemFont::setFontSize(60);
MenuItemFont* newGameItem = MenuItemFont::create("START", CC_CALLBACK_1(TitleScene::menuSceneTransition, this));
auto label1 = Label::createWithTTF("START", "fonts/arial.ttf", 55);
label1->setColor(Color3B::BLACK);
label1->enableOutline(Color4B::BLACK, 2);
newGameItem->setLabel(label1);
auto menu = Menu::create(newGameItem, NULL);
menu->setPosition(Vec2(m_visibleSize.width / 2, m_visibleSize.height / 3.7));
this->addChild(menu);
}
示例3: displayMenu
void TitleScene::displayMenu(bool loadContent)
{
MenuItemFont::setFontSize(60);
MenuItemFont* newGameItem = MenuItemFont::create("NEW GAME", CC_CALLBACK_1(TitleScene::menuSceneTransition, this, true));
MenuItemFont* continueItem = MenuItemFont::create("CONTINUE", CC_CALLBACK_1(TitleScene::menuSceneTransition, this, false));
auto label1 = Label::createWithTTF("NEW GAME", "fonts/arial.ttf", 45);
auto label2 = Label::createWithTTF("CONTINUE", "fonts/arial.ttf", 45);
label1->enableOutline(Color4B::WHITE, 2);
label2->enableOutline(Color4B::WHITE, 2);
newGameItem->setLabel(label1);
continueItem->setLabel(label2);
if (!loadContent)
{
continueItem->setEnabled(false);
}
loadMenu = Menu::create(newGameItem, continueItem, NULL);
loadMenu->setPosition(Vec2(visibleSize.width / 2, visibleSize.height / 3));
loadMenu->alignItemsVerticallyWithPadding(30);
loadMenu->setVisible(false);
this->addChild(loadMenu);
string btn = "img/UI/home/UI_T_002.png";
string pushBtn = "img/UI/home/UI_T_003.png";
auto startBtn = MenuItemImage::create(btn.c_str(),
pushBtn.c_str(),
CC_CALLBACK_1(TitleScene::showLoadMenu, this, loadMenu));
startBtn->setScale(m_Mag);
startMenu = Menu::create(startBtn, NULL);
startMenu->setPosition(Vec2(visibleSize.width / 2, visibleSize.height / 3));
this->addChild(startMenu);
//Fade in - Fade out animation
cocos2d::Vector<cocos2d::FiniteTimeAction*> fadeAnimation;
fadeAnimation.pushBack(FadeOut::create(3));
fadeAnimation.pushBack(FadeIn::create(3));
auto sequence = Sequence::create(fadeAnimation);
auto repetition = RepeatForever::create(sequence);
startMenu->runAction(repetition);
}
示例4: displayUI
void Picking::displayUI()
{
eventHandler();
displayHP();
for (int i = 0; i < 4; i++)
{
m_glow[i] = Sprite::create("img/UI/battle/glow.png");
m_glow[i]->setScale(m_Mag*0.5);
m_glow[i]->setPosition(Vec2(m_visibleSize.width / 8 * (((i + 1) * 1.5) + 1), m_cards[1]->getPositionY()));
m_glow[i]->setZOrder(2);
m_glow[i]->setTag(5);
m_instance->addChild(m_glow[i]);
}
//instructions to reshuffle
instructions = Label::createWithTTF("いらないカードをシャッフルしよう!", "fonts/ant-maru.ttf", 55);
instructions->enableOutline(Color4B::BLACK, 2);
instructions->setPosition(Vec2(m_visibleSize.width / 2, m_visibleSize.height /2.4));
m_instance->addChild(instructions);
auto Label = Label::createWithTTF("<< Enemy Card", "fonts/arial.ttf", 25);
Label->setColor(Color3B::RED);
Label->enableOutline(Color4B::BLACK, 2);
Label->setPosition(Vec2(m_enemyCard->getPosition().x * 0.9, m_enemyCard->getBoundingBox().getMaxY()));
Label->setName("EnemyCard");
//m_instance->addChild(Label);
MenuItemFont::setFontSize(80);
MenuItemFont* goItem = MenuItemFont::create("Go!", CC_CALLBACK_1(Picking::startBattle, this));
auto label = Label::createWithTTF("GO!", "fonts/ant-maru.ttf", 60);
label->enableOutline(Color4B::RED, 2);
goItem->setLabel(label);
goItem->setPosition(Vec2(m_visibleSize.width / 1.15, m_visibleSize.height / 2));
m_menu = Menu::create(goItem, NULL);
m_menu->setPosition(Point::ZERO);
m_instance->addChild(m_menu);
}