本文整理汇总了C++中CCMenuItemFont::setFontSizeObj方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItemFont::setFontSizeObj方法的具体用法?C++ CCMenuItemFont::setFontSizeObj怎么用?C++ CCMenuItemFont::setFontSizeObj使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenuItemFont
的用法示例。
在下文中一共展示了CCMenuItemFont::setFontSizeObj方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CCLog
bool Challenge2048GameOver::init()
{
CCLog("bool Challenge2048GameOver::init()");
if ( BasePanelLayer::init())
{
CCSize visiSize = CCDirector::sharedDirector()->getVisibleSize();
CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
CCSprite* pSprite = CCSprite::create("bg06.jpg");
pSprite->setPosition(ccp(visiSize.width/2 + origin.x, visiSize.height/2 + origin.y));
this->addChild(pSprite);
CCMenuItemFont* menuRestart = CCMenuItemFont::create("Restart", this, menu_selector(Challenge2048GameOver::restart));
CCMenuItemFont* menuBack = CCMenuItemFont::create("BackHome", this, menu_selector(Challenge2048GameOver::backHome));
menuBack->setFontSizeObj(80);
menuRestart->setFontSizeObj(80);
float cw = visiSize.width * 0.5 + origin.x;
menuRestart->setPosition(CCPoint(cw, visiSize.height * 0.57 + origin.y));
menuBack->setPosition(CCPoint(cw, visiSize.height * 0.43 + origin.y));
CCMenu* menus = CCMenu::create(menuRestart, menuBack, NULL);
menus->setPosition(CCPoint(0,0));
this->addChild(menus);
return true;
}
return false;
}
示例2: init
bool GameMenu::init()
{
if ( !CCLayer::init() )
{
return false;
}
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCMenuItemFont *pCloseItem = CCMenuItemFont::create("Quit Game",
this,
menu_selector(GameMenu::menuCloseCallback) );
pCloseItem->setPosition( ccp(size.width/2, size.height/8) );
pCloseItem->setFontSizeObj(25);
pCloseItem->setFontNameObj("Georgia-Bold");
CCMenuItemFont* pStartItem = CCMenuItemFont::create("Start Game",
this,
menu_selector(GameMenu::menuStartCallback) );
pStartItem->setPosition(ccp(size.width/2,size.height/4));
pStartItem->setFontSizeObj(40);
pStartItem->setFontNameObj("Georgia-Bold");
CCMenuItemFont* pNextItem = CCMenuItemFont::create(">",
this,
menu_selector(GameMenu::selectNext) );
pNextItem->setPosition(ccp(size.width/3*2,size.height/5*2));
pNextItem->setFontSizeObj(80);
pNextItem->setFontNameObj("Georgia-Bold");
CCMenuItemFont* pBackItem = CCMenuItemFont::create("<",
this,
menu_selector(GameMenu::selectBack) );
pBackItem->setPosition(ccp(size.width/3,size.height/5*2));
pBackItem->setFontSizeObj(80);
pBackItem->setFontNameObj("Georgia-Bold");
// create menu, it's an autorelease object
CCMenu* pMenu = CCMenu::create(pCloseItem, pStartItem, pNextItem, pBackItem, NULL);
pMenu->setPosition( CCPointZero );
this->addChild(pMenu, 1);
CCSprite* pGameName = CCSprite::create("BattleCity.png");
pGameName->setScale(2.0f);
pGameName->setPosition(ccp(size.width/2,size.height/3*2));
this->addChild(pGameName,1);
CCLabelTTF *LevelLabel = CCLabelTTF::create("Level 1", "Georgia-Bold", 55);
LevelLabel->setString(CCString::createWithFormat("Level %d", m_level)->getCString());
LevelLabel->setPosition(ccp(size.width/2,size.height/5*2));
this->addChild(LevelLabel,2,888);
return true;
}
示例3: init
bool ActorBoardLayer::init()
{
bool bRet =false;
do {
CC_BREAK_IF(!CCLayer::init());
setTouchEnabled(true);
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCSprite* background = CCSprite::createWithSpriteFrameName("bg_over.png");
background->setAnchorPoint(ccp(0, 0));
this->addChild(background);
CCSize size1 = background->getContentSize();
float scale1 = winSize.width/size1.width;
float scale2 = winSize.height/size1.height;
background->setScaleX(scale1);
background->setScaleY(scale2);
CCMenuItemFont *add = CCMenuItemFont::create("关闭", this, menu_selector(ActorBoardLayer::closeMe));
add->setPosition(CCPointZero);
add->setFontSizeObj(35);
add->setColor(ccRED);
CCMenu *menu0 = CCMenu::createWithItem(add);
menu0->setPosition( winSize.width-150, winSize.height-100);
this->addChild(menu0);
m_Htab = HTabGroupLayerBase::create();
m_Htab->creatTabsWithCount(this, 4,AlignLeft,winSize);
m_Htab->setAnchorPoint(CCPointZero);
m_Htab->setPosition(0, 0);
this->addChild(m_Htab);
bRet = true;
} while (0);
return bRet;
}
示例4: onLoadScene
void MenuScene::onLoadScene()
{
m_vMenuItems.push_back("Basic Test");
CCSize tContainerSize = CCSize(700, 100 * m_vMenuItems.size());
CCLayer* pScrollViewContainer = CCLayer::create();
pScrollViewContainer->setPosition(CCPointZero);
pScrollViewContainer->setContentSize(tContainerSize);
m_pScrollView = CCScrollView::create(CCSize(700, 640));
m_pScrollView->setDirection(kCCScrollViewDirectionVertical);
m_pScrollView->ignoreAnchorPointForPosition(false);
m_pScrollView->setPosition(CCPoint(480, 320));
m_pScrollView->setContainer(pScrollViewContainer);
addChild(m_pScrollView);
CCArray* pArray = CCArray::create();
float height = tContainerSize.height;
unsigned int i = 0;
unsigned int end = m_vMenuItems.size();
for(; i < end; ++i )
{
CCMenuItemFont* pFont = CCMenuItemFont::create(m_vMenuItems[i].c_str());
pFont->setTarget(this, menu_selector(MenuScene::onClick));
pFont->setFontSizeObj(45.0f);
pFont->setPosition(ccp(700 / 2, height - 100 / 2));
pFont->setTag(i + 1);
pArray->addObject(pFont);
height -= 100;
}
CCMenu* pMenu = CCMenu::createWithArray(pArray);
pMenu->setPosition(ccp(0,0));
pScrollViewContainer->addChild(pMenu);
m_pScrollView->setContentOffset(ccp(0, -(tContainerSize.height - 640)));
}
示例5: init
bool GameHud::init()
{
bool ret = false;
do {
CC_BREAK_IF(!CCLayer::init());
CCSize winsize = CCDirector::sharedDirector()->getWinSize();
CCSprite* background = CCSprite::create("hud.png");
background->setAnchorPoint(CCPointZero);
float saclex = winsize.width/background->boundingBox().size.width;
background->setScaleX(saclex);
this->addChild(background);
CCMenuItemSprite * item1 = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("A1_0.png"), CCSprite::createWithSpriteFrameName("A1_0.png"), this, menu_selector(GameHud::soldier1_Select));
item1->setPosition(ccp(10,10));
CCMenuItemSprite * item2 = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("A2_0.png"), CCSprite::createWithSpriteFrameName("A2_0.png"), this, menu_selector(GameHud::soldier2_Select));
item2->setPosition(ccp(110, 10));
CCMenuItemSprite * item3 = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("A3_0.png"), CCSprite::createWithSpriteFrameName("A3_0.png"), this, menu_selector(GameHud::soldier3_Select));
item3->setPosition(ccp(210, 10));
CCMenuItemSprite * item4 = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("A4_0.png"), CCSprite::createWithSpriteFrameName("A4_0.png"), this, menu_selector(GameHud::soldier4_Select));
item4->setPosition(ccp(310, 10));
CCMenu* menu = CCMenu::create(item1,item2,item3,item4,NULL);
menu->setPosition(ccp(100,30));
menu->setTag(10);
this->addChild(menu);
selectFlag = CCSprite::create("aim.png");
selectFlag->retain();
selectFlag->setScale(0.5f);
selectFlag->setPosition( ccpAdd(item1->getPosition(), menu->getPosition()));
this->addChild(selectFlag);
CCLabelTTF* lab = CCLabelTTF::create("所需 100 援兵", "Arial-BoldMT", 20);
lab->setColor(ccRED);
lab->setTag(101);
lab->setPosition(ccp(600, 40));
this->addChild(lab);
CCMenuItemFont *add = CCMenuItemFont::create("增援", this, menu_selector(GameHud::click_addSoldier));
add->setPosition(CCPointZero);
add->setFontSizeObj(35);
add->setColor(ccRED);
CCMenu *menu0 = CCMenu::createWithItem(add);
menu0->setPosition( winsize.width-200, 40);
this->addChild(menu0);
CCMenuItemSprite* btn_attack = CCMenuItemSprite::create(
CCSprite::createWithSpriteFrameName("btn_soldierattack1.png"),
CCSprite::createWithSpriteFrameName("btn_soldierattack2.png"),
this, menu_selector(GameHud::click_attack));
CCMenu* menu1 = CCMenu::createWithItem(btn_attack);
menu1->setPosition(ccp(winsize.width-100,40));
this->addChild(menu1);
soldier1_Select(item1);
timerLab = CCLabelTTF::create("5", "Arial-BoldMT", 50);
timerLab->setPosition(ccp(winsize.width/2, winsize.height/2));
this->addChild(timerLab);
this->setTouchEnabled(true);
this->schedule(schedule_selector(GameHud::countDown), 1.0f);
MaskLayer* mask = MaskLayer::create();
this->addChild(mask);
mask->setTag(11);
GameRoot::shareGameRoot()->sethasStart(false);
count =3;
ret = true;
} while (0);
return ret;
}