本文整理汇总了C++中CCMenuItemFont类的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItemFont类的具体用法?C++ CCMenuItemFont怎么用?C++ CCMenuItemFont使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCMenuItemFont类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getBoxMenu
bool BoxMenu::init()
{
if(!CCLayer::init())
{
return false;
}
CCMenu *teamMenu;
CCMenuItemFont::setFontName("΢ÈíÑźÚ");
CCMenuItemFont::setFontSize(20);
teamMenu = getBoxMenu();
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
string gameTitle = GameTitleString;
GBKToUTF8(gameTitle,"gbk","utf-8");
CCMenuItemFont::setFontSize(26);
CCMenuItemFont *titleItem = CCMenuItemFont::create(gameTitle.c_str(), this, menu_selector(BoxMenu::scoreSort));
titleItem->setColor(ccc3(0xc3, 0xa8, 0x91));
titleItem->setPosition(CCPointMake(0, winSize.height/2 - 30));
teamMenu->addChild(titleItem);
CCSprite *backgroudSprite = CCSprite::create(mainBackgroudFile);
backgroudSprite->setPosition(CCPointMake(winSize.width/2, winSize.height/2));
addChild(teamMenu, 0);
addChild(backgroudSprite, -2);
return true;
}
示例2: getFish
cocos2d::CCNode* SceneEditorTestLayer::createGameScene()
{
CCNode *pNode = CCSSceneReader::sharedSceneReader()->createNodeWithSceneFile("scenetest/FishJoy2.json");
if (pNode == NULL)
{
return NULL;
}
m_pCurNode = pNode;
//fishes
CCArmature *pBlowFish = getFish(10008, "blowFish");
CCArmature *pButterFlyFish = getFish(10009, "butterFlyFish");
pBlowFish->getAnimation()->playByIndex(0);
pButterFlyFish->getAnimation()->playByIndex(0);
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(SceneEditorTestLayer::toExtensionsMainLayer));
itemBack->setColor(ccc3(255, 255, 255));
itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
CCMenu *menuBack = CCMenu::create(itemBack, NULL);
menuBack->setPosition(CCPointZero);
menuBack->setZOrder(4);
pNode->addChild(menuBack);
//ui action
cocos2d::extension::UIActionManager::shareManager()->PlayActionByName("startMenu_1.json","Animation1");
return pNode;
}
示例3: onEnter
void PerformBasicLayer::onEnter()
{
CCLayer::onEnter();
CCMenuItemFont::setFontName("Arial");
CCMenuItemFont::setFontSize(24);
CCMenuItemFont* pMainItem = CCMenuItemFont::create("Back", this,
menu_selector(PerformBasicLayer::toMainLayer));
pMainItem->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
CCMenu* pMenu = CCMenu::create(pMainItem, NULL);
pMenu->setPosition( CCPointZero );
if (m_bControlMenuVisible)
{
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(PerformBasicLayer::backCallback) );
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(PerformBasicLayer::restartCallback) );
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(PerformBasicLayer::nextCallback) );
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
pMenu->addChild(item1, kItemTagBasic);
pMenu->addChild(item2, kItemTagBasic);
pMenu->addChild(item3, kItemTagBasic);
}
addChild(pMenu);
}
示例4: CCRectMake
cocos2d::CCNode* ComponentsTestLayer::createGameScene()
{
CCNode *root = NULL;
do
{
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
CCSprite *player = CCSprite::create("components/Player.png", CCRectMake(0, 0, 27, 40) );
player->setPosition( ccp(origin.x + player->getContentSize().width/2,
origin.y + visibleSize.height/2) );
root = cocos2d::CCNode::create();
root->addChild(player, 1, 1);
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(ComponentsTestLayer::toExtensionsMainLayer));
itemBack->setColor(ccc3(0, 0, 0));
itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
CCMenu *menuBack = CCMenu::create(itemBack, NULL);
menuBack->setPosition(CCPointZero);
addChild(menuBack);
}while (0);
return root;
}
示例5: onEnter
void PerformBasicLayer::onEnter()
{
CCLayer::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCMenuItemFont::setFontName("Arial");
CCMenuItemFont::setFontSize(24);
CCMenuItemFont* pMainItem = CCMenuItemFont::itemFromString("Back", this,
menu_selector(PerformBasicLayer::toMainLayer));
pMainItem->setPosition(ccp(s.width - 50, 25));
CCMenu* pMenu = CCMenu::menuWithItems(pMainItem, NULL);
pMenu->setPosition( CCPointZero );
if (m_bControlMenuVisible)
{
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(PerformBasicLayer::backCallback) );
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(PerformBasicLayer::restartCallback) );
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(PerformBasicLayer::nextCallback) );
item1->setPosition( ccp( s.width/2 - 100,30) );
item2->setPosition( ccp( s.width/2, 30) );
item3->setPosition( ccp( s.width/2 + 100,30) );
pMenu->addChild(item1, kItemTagBasic);
pMenu->addChild(item2, kItemTagBasic);
pMenu->addChild(item3, kItemTagBasic);
}
addChild(pMenu);
}
示例6: CCMenuItemFont
CCMenuItemFont * CCMenuItemFont::itemFromString(const char *value)
{
CCMenuItemFont *pRet = new CCMenuItemFont();
pRet->initFromString(value, NULL, NULL);
pRet->autorelease();
return pRet;
}
示例7: ccc3
bool GameOverLayer::init()
{
if ( CCLayerColor::initWithColor( ccc4(255,255,255,255) ) )
{
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
this->_label = CCLabelTTF::create("","Artial", 32);
_label->retain();
_label->setColor( ccc3(0, 0, 0) );
_label->setPosition( ccp(winSize.width/2, winSize.height/2) );
this->addChild(_label);
this->runAction( CCSequence::create(
CCDelayTime::create(3),
CCCallFunc::create(this,
callfunc_selector(GameOverLayer::gameOverDone)),
NULL));
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(ComponentsTestLayer::toExtensionsMainLayer));
itemBack->setColor(ccc3(0, 0, 0));
itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
CCMenu *menuBack = CCMenu::create(itemBack, NULL);
menuBack->setPosition(CCPointZero);
addChild(menuBack);
return true;
}
else
{
return false;
}
}
示例8: menu_selector
bool FFGameScene::init()
{
if (!CCLayer::init()) {
return false;
}
CCSize visibleSize = CCDirector::sharedDirector()->getWinSize();
CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
this->m_pMapLayer = FFMapLayer::create();
this->m_pMapLayer->setDelegate(this);
FFLevel *tempLevel = FFLevelManager::sharedInstance()->currentLevel();
this->m_pMapLayer->loadMapWithLevel(tempLevel);
this->addChild(this->m_pMapLayer, 1);
CCMenuItemFont *pExitItem = CCMenuItemFont::create("exit", this, menu_selector(FFGameScene::menuExitCallback));
pExitItem->setPosition(ccp(origin.x + visibleSize.width/2, origin.y + visibleSize.height/2));
CCMenu* pMenu = CCMenu::create(pExitItem, NULL);
pMenu->setPosition(CCPointZero);
this->addChild(pMenu, 1);
return true;
}
示例9: ccp
bool AboutScene::init()
{
if ( !CCLayer::init() )
{
return false;
}
//--------------------------
//加入简介和图片
CCSize size = CCDirector::sharedDirector()->getWinSize();
// add "HelloWorld" splash screen"
CCSprite* pSprite = CCSprite::create("HelloWorld.png");
// position the sprite on the center of the screen
pSprite->setPosition( ccp(size.width/2, size.height/2) );
// add the sprite as a child to this layer
this->addChild(pSprite, 0);
// TODO 坐标有问题
CCMenuItemFont* back = CCMenuItemFont::create("Back", this, menu_selector(AboutScene::menuBackCallback));
back->setPosition(ccp(50, 100));
CCMenu *pMenu = CCMenu::create(back, NULL);
this->addChild(pMenu, 0);
return true;
}
示例10: ccp
void MyBuildingCard::displayDetail(cocos2d::CCNode *psender){
MyBuildingCard* card = (MyBuildingCard*)psender->getParent()->getParent();
activeCard = card;
oriPosition = card->getPosition();
card->runAction(CCEaseInOut::create(CCMoveTo::create(0.2, ccp(200-card->getParent()->getPosition().x,320)),2));
card->runAction(CCEaseInOut::create(CCScaleTo::create(0.2, 1.2),2));
card->isEnabled = false;
((GXScrollView*)(card->getParent()))->setEnabled(false);
card->getParent()->reorderChild(card, 100000);
CCMenuItemSprite* gray = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("dialoggray.png"), CCSprite::createWithSpriteFrameName("dialoggray.png"));
MyPriorityMenu* grayMenu = MyPriorityMenu::create(-503,gray,NULL);
grayMenu->setTag(grayTag);
card->getParent()->addChild(grayMenu,99999);
gray->setScaleX(960/gray->getContentSize().width);
gray->setScaleY(540/gray->getContentSize().height);
grayMenu->setPosition(ccp(480-card->getParent()->getPosition().x,320));
// gray->setPosition(ccp(0,0));
CCSprite* detailBack = CCSprite::createWithSpriteFrameName("creatoruidetail.jpg"); detailBack->setPosition(ccp(634-card->getParent()->getPosition().x,-detailBack->getContentSize().height/2-100));
detailBack->setScale(1.2);
detailBack->setTag(detailBackTag);
card->getParent()->addChild(detailBack,100000);
detailBack->runAction(CCSequence::create(CCDelayTime::create(0.2),CCEaseInOut::create(CCMoveTo::create(0.2, ccp(634-card->getParent()->getPosition().x,320)),2), NULL));
CCMenuItemFont::setFontSize(24);
CCMenuItemFont* back = CCMenuItemFont::create("返回",this,menu_selector(MyBuildingCard::cancelDetail));
back->setColor(ccc3(114,66,45));
MyPriorityMenu* backMenu = MyPriorityMenu::create(-503,back,NULL);
backMenu->setPosition(ccp(detailBack->getContentSize().width-44,44));
detailBack->addChild(backMenu,NULL);
}
示例11: alignmentChanged
void BitmapFontMultiLineAlignment::alignmentChanged(cocos2d::CCObject *sender)
{
CCMenuItemFont *item = (CCMenuItemFont*)sender;
item->setColor(ccRED);
this->m_pLastAlignmentItem->setColor(ccWHITE);
this->m_pLastAlignmentItem = item;
switch(item->getTag())
{
case LeftAlign:
this->m_pLabelShouldRetain->setAlignment(kCCTextAlignmentLeft);
break;
case CenterAlign:
this->m_pLabelShouldRetain->setAlignment(kCCTextAlignmentCenter);
break;
case RightAlign:
this->m_pLabelShouldRetain->setAlignment(kCCTextAlignmentRight);
break;
default:
break;
}
this->snapArrowsToEdge();
}
示例12: CCMenuItemFont
CCMenuItemFont * CCMenuItemFont::create(const char *value)
{
CCMenuItemFont *pRet = new CCMenuItemFont();
pRet->initWithString(value, NULL, NULL);
pRet->autorelease();
return pRet;
}
示例13: CC_BREAK_IF
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;
}
示例14: schedule
void SceneGame::startClient(CCObject*obj)
{
if (Net::Connect("127.0.0.1"))
{
// 把棋子倒过来
for (int i = 0; i < 32; i++)
{
Stone* s = _s[i];
s->_row = 9 - s->_row;
s->_col = 8 - s->_col;
s->setPosition(s->fromPlate());
}
// 开始接收
Net::RecvStart();
schedule(schedule_selector(SceneGame::CheckRecv));
Net::_isConnected = true;
_bRedSide = false;
CCMenuItemFont *font = (CCMenuItemFont *)obj;
CCMenuItemFont *server = (CCMenuItemFont *)font->getUserObject();
server->setEnabled(false);
font->setEnabled(false);
}
else
{
CCLog("Connect failure....");
}
}
示例15: ccc4
KDbool OverScene::init ( KDvoid )
{
if ( !CCLayer::init ( ) )
{
return KD_FALSE;
}
CCMenuItemFont::setFontSize ( 32 );
CCMenuItemFont::setFontName ( "Arial.ttf" );
CCLayerColor* pLayer = CCLayerColor::create ( ccc4 ( 32, 32, 32, 255 ) );
this->addChild ( pLayer, 1 );
m_pTopScore = CCLabelTTF::create ( "0", "Arial.ttf", 32 );
this->addChild ( m_pTopScore, 3 );
m_pTopScore->setColor ( ccc3 ( 255, 0, 0 ) );
m_pTopScore->setPosition ( ccp ( 160, 370 - 50 ) );
m_pScore = CCLabelTTF::create ( "0", "Arial.ttf", 32 );
this->addChild ( m_pScore, 3 );
m_pScore->setColor ( ccc3 ( 0, 0, 255 ) );
m_pScore->setPosition ( ccp ( 160, 320 - 40 ) );
CCMenuItemFont* pReStart = CCMenuItemFont::create ( "RESTART", this, menu_selector ( OverScene::onReStart ) );
pReStart->setColor ( ccc3 ( 0x00, 0xCC, 0x00 ) );
CCMenu* pMenu = CCMenu::create ( pReStart, KD_NULL );
pMenu->setPosition ( ccpMid ( m_tContentSize ) );
pMenu->alignItemsVerticallyWithPadding ( 20.0f );
this->addChild ( pMenu, 2 );
return KD_TRUE;
}