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


C++ CCMenuItemFont::setPosition方法代码示例

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


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

示例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;
}
开发者ID:lyzz0612,项目名称:Game,代码行数:58,代码来源:GameMenu.cpp

示例3: CreateMenu

void MainScene::CreateMenu()
{
   if(_menu == NULL)
   {
      CCSize scrSize = CCDirector::sharedDirector()->getWinSize();
      
      _menu = CCMenu::create();
      _menu->setPosition(ccp(0,0));
      addChild(_menu);
      
      
      CCMenuItemFont* pItem;
      CCPoint position;
      
      // Create the next/back menu items.
      for(int page = 0; page < MENU_PAGES; page++)
      {
         // Create the Back/Forward buttons for the page.
         // Back arrow if there is a previous page.
         if(page > 0)
         {
            pItem = CCMenuItemFont::create("Back", this, menu_selector(MainScene::MenuCallback));
            pItem->setTag(ARROW_LEFT);
            position = ccp(page*scrSize.width + scrSize.width*0.1,scrSize.height*0.1);
            pItem->setPosition(position);
            pItem->setFontSize(35);
            pItem->setFontName("Arial");
            _menu->addChild(pItem);
         }
         if(page < (MENU_PAGES-1))
         {
            pItem = CCMenuItemFont::create("Next", this, menu_selector(MainScene::MenuCallback));
            pItem->setTag(ARROW_RIGHT);
            position = ccp(page*scrSize.width + scrSize.width*0.9,scrSize.height*0.1);
            pItem->setPosition(position);
            pItem->setFontSize(35);
            pItem->setFontName("Arial");
            _menu->addChild(pItem);
         }
      }
      // Create the actual items
      for(int idx = 0; idx < MENU_ITEMS_TOTAL; idx++)
      {
         char buffer[256];
         sprintf(buffer,"Item #%d",idx);
         pItem = CCMenuItemFont::create(buffer, this, menu_selector(MainScene::MenuCallback));
         pItem->setFontSize(35);
         pItem->setFontName("Arial");
         pItem->setTag(idx);
         position = CalculatePosition(idx);
         pItem->setPosition(position);
         _menu->addChild(pItem);
         
      }
   }
}
开发者ID:NonlinearIdeas,项目名称:SlidingMenuDemo,代码行数:56,代码来源:MainScene.cpp

示例4: 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);
}
开发者ID:kehaoran74,项目名称:Scut,代码行数:27,代码来源:PerformanceTest.cpp

示例5: init

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;
}
开发者ID:FelixZhu,项目名称:Quell,代码行数:28,代码来源:BoxMenu.cpp

示例6: createGameScene

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;
}
开发者ID:rifi,项目名称:cocos2d-x,代码行数:29,代码来源:SceneEditorTest.cpp

示例7: 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);
}
开发者ID:AfterTheRainOfStars,项目名称:cocos2d-x-qt,代码行数:29,代码来源:PerformanceTest.cpp

示例8: init

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;
}
开发者ID:zhu410289616,项目名称:FFDonkey,代码行数:25,代码来源:FFGameScene.cpp

示例9: 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;
}
开发者ID:9cat,项目名称:dotawar,代码行数:35,代码来源:ActorBoardLayer.cpp

示例10: createGameScene

cocos2d::CCNode* SceneEditorTestLayer::createGameScene()
{
    CCNode *pNode = CCJsonReader::sharedJsonReader()->createNodeWithJsonFile("FishJoy2.json");
	if (pNode == NULL)
	{
		return NULL;
	}
	m_pCurNode = pNode;

	//play back music
    CCComAudio *pAudio = (CCComAudio*)(pNode->getComponent("Audio"));
	pAudio->playBackgroundMusic(pAudio->getFile(), pAudio->getIsLoop());

	//fishes
	CCArmature *pBlowFish = getFish(5, "blowFish");
	CCArmature *pButterFlyFish = getFish(6, "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;
}
开发者ID:chenxu111,项目名称:Cocos2d-x-For-CocoStudio,代码行数:33,代码来源:SceneEditorTestScene.cpp

示例11: init

// on "init" you need to initialize your instance
bool TableViewTestLayer::init()
{
    if ( !CCLayer::init() )
    {
        return false;
    }

	CCSize winSize = CCDirector::sharedDirector()->getWinSize();

    CCTableView* tableView = CCTableView::create(this, CCSizeMake(250, 60));
    tableView->setDirection(kCCScrollViewDirectionHorizontal);
    tableView->setPosition(ccp(20,winSize.height/2-30));
    tableView->setDelegate(this);
    this->addChild(tableView);
    tableView->reloadData();

	tableView = CCTableView::create(this, CCSizeMake(60, 280));
	tableView->setDirection(kCCScrollViewDirectionVertical);
	tableView->setPosition(ccp(winSize.width-150,winSize.height/2-120));
	tableView->setDelegate(this);
	tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
	this->addChild(tableView);
	tableView->reloadData();

	// Back Menu
	CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(TableViewTestLayer::toExtensionsMainLayer));
	itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
	CCMenu *menuBack = CCMenu::create(itemBack, NULL);
	menuBack->setPosition(CCPointZero);
	addChild(menuBack);

    return true;
}
开发者ID:BradB132,项目名称:cocos2d-x,代码行数:34,代码来源:TableViewTestScene.cpp

示例12: createGameScene

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;
}
开发者ID:0309,项目名称:cocos2d-x,代码行数:29,代码来源:ComponentsTestScene.cpp

示例13: init

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;
	}
}
开发者ID:0309,项目名称:cocos2d-x,代码行数:32,代码来源:GameOverScene.cpp

示例14: init

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;

}
开发者ID:jpollo,项目名称:ShootGame,代码行数:32,代码来源:AboutScene.cpp

示例15: addChild

HttpClientTest::HttpClientTest() 
: m_labelStatusCode(NULL)
{
    CCSize winSize = CCDirector::sharedDirector()->getWinSize();

    const int MARGIN = 40;
    const int SPACE = 35;
    
    CCLabelTTF *label = CCLabelTTF::create("Http Request Test", "Arial", 28);
    label->setPosition(ccp(winSize.width / 2, winSize.height - MARGIN));
    addChild(label, 0);
    
    CCMenu *menuRequest = CCMenu::create();
    menuRequest->setPosition(CCPointZero);
    addChild(menuRequest);
    
    // Get 
    CCLabelTTF *labelGet = CCLabelTTF::create("Test Get", "Arial", 22);
    CCMenuItemLabel *itemGet = CCMenuItemLabel::create(labelGet, this, menu_selector(HttpClientTest::onMenuGetTestClicked));
    itemGet->setPosition(ccp(winSize.width / 2, winSize.height - MARGIN - SPACE));
    menuRequest->addChild(itemGet);
    
    // Post
    CCLabelTTF *labelPost = CCLabelTTF::create("Test Post", "Arial", 22);
    CCMenuItemLabel *itemPost = CCMenuItemLabel::create(labelPost, this, menu_selector(HttpClientTest::onMenuPostTestClicked));
    itemPost->setPosition(ccp(winSize.width / 2, winSize.height - MARGIN - 2 * SPACE));
    menuRequest->addChild(itemPost);
    
    // Post Binary
    CCLabelTTF *labelPostBinary = CCLabelTTF::create("Test Post Binary", "Arial", 22);
    CCMenuItemLabel *itemPostBinary = CCMenuItemLabel::create(labelPostBinary, this, menu_selector(HttpClientTest::onMenuPostBinaryTestClicked));
    itemPostBinary->setPosition(ccp(winSize.width / 2, winSize.height - MARGIN - 3 * SPACE));
    menuRequest->addChild(itemPostBinary);

    // Put
    CCLabelTTF *labelPut = CCLabelTTF::create("Test Put", "Arial", 22);
    CCMenuItemLabel *itemPut = CCMenuItemLabel::create(labelPut, this, menu_selector(HttpClientTest::onMenuPutTestClicked));
    itemPut->setPosition(ccp(winSize.width / 2, winSize.height - MARGIN - 4 * SPACE));
    menuRequest->addChild(itemPut);

    // Delete
    CCLabelTTF *labelDelete = CCLabelTTF::create("Test Delete", "Arial", 22);
    CCMenuItemLabel *itemDelete = CCMenuItemLabel::create(labelDelete, this, menu_selector(HttpClientTest::onMenuDeleteTestClicked));
    itemDelete->setPosition(ccp(winSize.width / 2, winSize.height - MARGIN - 5 * SPACE));
    menuRequest->addChild(itemDelete);
    
    // Response Code Label
    m_labelStatusCode = CCLabelTTF::create("HTTP Status Code", "Marker Felt", 20);
    m_labelStatusCode->setPosition(ccp(winSize.width / 2,  winSize.height - MARGIN - 6 * SPACE));
    addChild(m_labelStatusCode);
    
    // Back Menu
    CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(HttpClientTest::toExtensionsMainLayer));
    itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
    CCMenu *menuBack = CCMenu::create(itemBack, NULL);
    menuBack->setPosition(CCPointZero);
    addChild(menuBack);
}
开发者ID:0309,项目名称:cocos2d-x,代码行数:58,代码来源:HttpClientTest.cpp


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