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


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

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


在下文中一共展示了CCMenuItemFont::getPositionY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

bool FriendList::init()
{
    if ( !CCLayer::init())
    {
        return false;
    }
    
    mEnableHighScoreDisplay = false;
    mEnableInstalledDisplay = false;
    mReadyForNextDownload   = false;
    mPhotoLoadIndex         = 0;
    
    EziSocialObject::sharedObject()->setFacebookDelegate(this);
    
    CCSize winSize = CCDirector::sharedDirector()->getVisibleSize();
    SCREEN_WIDTH  = winSize.width;
    SCREEN_HEIGHT = winSize.height;
    
    CCLayerColor *backgroundLayer = CCLayerColor::create(ccc4(20, 100, 100, 255), SCREEN_WIDTH, SCREEN_HEIGHT);
    
    this->addChild(backgroundLayer);
    
    
    MENU_FONT_SCALE = SCREEN_HEIGHT/320;
    
    
    // Back Menu
    
    CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(FriendList::showHomePage));
	itemBack->setPosition(ccp(SCREEN_WIDTH/2, (itemBack->getContentSize().height/2 + 2) * MENU_FONT_SCALE));
	
    CCMenuItemFont *itemHighScore = CCMenuItemFont::create("High Scores", this, menu_selector(FriendList::showHighScoreList));
    itemHighScore->setAnchorPoint(ccp(1, 0.5));
    itemHighScore->setPosition(ccp((SCREEN_WIDTH-10), itemBack->getPositionY()));
    
    CCMenuItemFont *allFriends = CCMenuItemFont::create("All Friends", this, menu_selector(FriendList::showAllFriendsList));
    allFriends->setAnchorPoint(ccp(0, 0.5));
    allFriends->setPosition(ccp((10), itemBack->getPositionY()));
    
    CCMenuItemFont *installedOnly = CCMenuItemFont::create("Installed Only", this, menu_selector(FriendList::showInstalledList));
    installedOnly->setAnchorPoint(ccp(0, 1));
    installedOnly->setPosition(ccp((10), SCREEN_HEIGHT - 2));
    
    CCMenuItemFont *notPlaying = CCMenuItemFont::create("Friends Not Playing", this, menu_selector(FriendList::showNotInstalledList));
    notPlaying->setAnchorPoint(ccp(1, 1));
    notPlaying->setPosition(ccp((SCREEN_WIDTH-10), SCREEN_HEIGHT - 2));
    
    
    
    
    itemBack->setScale(MENU_FONT_SCALE);
    itemHighScore->setScale(MENU_FONT_SCALE);
    allFriends->setScale(MENU_FONT_SCALE);
    installedOnly->setScale(MENU_FONT_SCALE);
    notPlaying->setScale(MENU_FONT_SCALE);
    
    CCMenu *menuBack = CCMenu::create(itemBack, itemHighScore, allFriends, installedOnly, notPlaying, NULL);
	menuBack->setPosition(CCPointZero);
	addChild(menuBack);
    
    float gap = itemBack->getContentSize().height * 2 * MENU_FONT_SCALE + (10 * MENU_FONT_SCALE);
    
    mFriendList = NULL;
    
    PHOTO_SCALE = SCREEN_HEIGHT/1536;
    
    if (PHOTO_SCALE <= 0.5 && PHOTO_SCALE > 0.25)
    {
        FB_DEFAULT_PHOTO = "fb_user_icon_half.jpg";
    }
    else if (PHOTO_SCALE < 0.25)
    {
        FB_DEFAULT_PHOTO = "fb_user_icon_quater.jpg";
    }
    
    
    CCSprite *sprite = CCSprite::create(FB_DEFAULT_PHOTO);
    CELL_HEIGHT = (sprite->getContentSize().height) + (40 * PHOTO_SCALE);
    
    
    mTableView = CCTableView::create(this, CCSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT - gap));
    mTableView->setDirection(kCCScrollViewDirectionVertical);
    mTableView->setPosition(ccp(0, gap/2));
    
    mTableView->setDelegate(this);
    this->addChild(mTableView);
    
    mTableView->reloadData();
    
    ALL_DOWNLOAD_COMPLETE = true;
    
    mLoadingImage = CCSprite::create("ball.png");
    mLoadingImage->setPosition(ccp(SCREEN_WIDTH/2, SCREEN_HEIGHT/2));
    mLoadingImage->retain();
    
    this->addChild(mLoadingImage);
    this->hideLoadingAction();
    
    return true;
}
开发者ID:chenbk85,项目名称:EziSocialDemo,代码行数:100,代码来源:FriendList.cpp


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