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


C++ CCMenuItemLabel::setAnchorPoint方法代码示例

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


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

示例1: setupViews

void AboutLayer::setupViews(){

    setBackgroundImage( "loading.png" );
    
    //  加入title
    CCSprite* title = CCSprite::create( "menuTitle.png",CCRectMake(0, 34, 130, 38) );
    
    title->setAnchorPoint( ccp(0.5, 1) );
    title->setPosition( ccp( getWinSize().width / 2 ,getWinSize().height -20 ) );
    this->addChild( title );
    //  加入文字说明
    
    CCLabelBMFont* pDes = CCLabelBMFont::create( "This Game is recoded by longlingxiu ", "arial-14.fnt" );
    
    pDes->setPosition( ccp(getWinSize().width / 2, getWinSize().height / 2) );
    
    this ->addChild(pDes);
    
    
    
    CCLabelBMFont* fontOfBack = CCLabelBMFont::create("Go Back", "arial-14.fnt" );
    
    fontOfBack->setScale(1.5f);
    
    CCMenuItemLabel* backLabel = CCMenuItemLabel::create(fontOfBack, this, menu_selector(AboutLayer::back_callback));
    backLabel->setAnchorPoint( ccp( 0.5, 0 ) );
    backLabel->setPosition( ccp( getWinSize().width / 2, 30) );
    
    CCMenu* menu = CCMenu::create( backLabel, NULL );;
    menu->setPosition( CCPointZero );
    
    this->addChild( menu );
    
}
开发者ID:897290110,项目名称:MyMoonWarrior,代码行数:34,代码来源:+AboutLayer.cpp

示例2: init

// on "init" you need to initialize your instance
bool TitleScene::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }

    //add the menu item for back to main menu
    int contentHeight = 0;
    int contentWidth = 0;
    m_pItemMenu = CCMenu::create();
    for (int i = 0; i < ITEM_COUNT; ++i)
    {
        CCLabelTTF* label = CCLabelTTF::create(menuItem[i].c_str(), "Arial", VisibleRect::getScaledFont(20));
        CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(TitleScene::menuCallback));
        pMenuItem->setAnchorPoint(CCPointZero);
        
        contentHeight = MAX(contentHeight, pMenuItem->getContentSize().height);
        contentWidth = MAX(contentWidth, pMenuItem->getContentSize().width);
        CCLog("Height = %d", contentHeight);
        CCLog("Width = %d", contentWidth);
        
        m_pItemMenu->addChild(pMenuItem, i + 10000);
    }
    
    m_pItemMenu->setContentSize(CCSizeMake(contentWidth, (ITEM_COUNT - 1) * contentHeight));
    m_pItemMenu->setPosition(ccp( CCDirector::sharedDirector()->getWinSize().width - m_pItemMenu->getContentSize().width, m_pItemMenu->getContentSize().height));
    m_pItemMenu->alignItemsVertically();
    this->addChild(m_pItemMenu, 1);
        
    /////////////////////////////
    // 3. add your codes below...
    
    // add a label shows "Hello World"
    // create and initialize a label
//    CCLabelTTF* pLabel = CCLabelTTF::create("Title Scene", "Thonburi", VisibleRect::getScaledFont(34));
//    
//    // ask director the window size
//    CCSize size = VisibleRect::getVisibleRect().size;
//    
//    // position the label on the center of the screen
//    pLabel->setPosition( ccp(size.width / 2, size.height - VisibleRect::getScaledFont(20)) );
//    
//    // add the label as a child to this layer
//    this->addChild(pLabel, 1);
    
    // add "HelloWorld" splash screen"
    CCSprite* pSprite = CCSprite::create("Default.png");
    pSprite->setScale(VisibleRect::getScale());
    
    // position the sprite on the center of the screen
    pSprite->setPosition( ccp(VisibleRect::getVisibleRect().size.width/2, VisibleRect::getVisibleRect().size.height/2) );
    
    // add the sprite as a child to this layer
    this->addChild(pSprite, 0);
    
    return true;
}
开发者ID:akinlin,项目名称:ProjectDrumroll,代码行数:61,代码来源:TitleScene.cpp

示例3: init

// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }

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

    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.

    // add a "close" icon to exit the progress. it's an autorelease object
    CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
                                        "CloseNormal.png",
                                        "CloseSelected.png",
                                        this,
                                        menu_selector(HelloWorld::menuCloseCallback) );
    pCloseItem->setPosition( ccp(size.width - 20, 20) );

    // create menu, it's an autorelease object
    CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
    pMenu->setPosition( CCPointZero );
    this->addChild(pMenu, 1);

    float yPos = 0;
    for (int i = 0; i < sizeof(s_EventMenuItem)/sizeof(s_EventMenuItem[0]); i++) {
        CCLabelTTF* label = CCLabelTTF::create(s_EventMenuItem[i].id.c_str(), "Arial", 24);
        CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(HelloWorld::eventMenuCallback));
        pMenu->addChild(pMenuItem, 0, s_EventMenuItem[i].tag);
        yPos = size.height - 50*i - 100;
        pMenuItem->setPosition( ccp(size.width / 2, yPos));
    }

    std::string strName = g_pAnalytics->getPluginName();
    std::string strVer = g_pAnalytics->getPluginVersion();
    char ret[256] = { 0 };
    sprintf(ret, "Plugin : %s, Ver : %s", strName.c_str(), strVer.c_str());
    CCLabelTTF* pLabel = CCLabelTTF::create(ret, "Arial", 24, CCSizeMake(size.width, 0), kCCTextAlignmentCenter);
    pLabel->setPosition(ccp(size.width / 2, yPos - 100));
    addChild(pLabel);

    CCLabelTTF* label = CCLabelTTF::create("reload all plugins", "Arial", 24);
    CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(HelloWorld::reloadPluginMenuCallback));
    pMenuItem->setAnchorPoint(ccp(0.5f, 0));
    pMenu->addChild(pMenuItem, 0);
    pMenuItem->setPosition( ccp(size.width / 2, 0));

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

示例4: Prepare

void UserInterface::Prepare() {
    CCLabelTTF *label = CCLabelTTF::create("Light ON/OFF", "HelveticaNeue-Bold", 25);
    CCMenuItemLabel *labelItem = CCMenuItemLabel::create(label, (CCObject *)engine, menu_selector(TEEngine::switchLight));
    ccColor3B color = {255, 255, 255};
    labelItem->setColor(color);
    labelItem->setPosition(CCPointZero);
    labelItem->setAnchorPoint(CCPointZero);
    CCMenu *menu = CCMenu::create(labelItem, nullptr);
    menu->setPosition(CCPoint(00, 560));
    menu->setTouchEnabled(true);
    _guiNodes->addObject(menu);
    
}
开发者ID:yariksmirnov,项目名称:TerminalExtraction,代码行数:13,代码来源:UserInterface.cpp

示例5: setupViews

//  对控件以及布景 进行初始化
void OptionLayer::setupViews(){
    
    //  加入背景图片
    
    setBackgroundImage( "loading.png" );
    
    //  加入menutitle
    CCSprite* title = CCSprite::create( "menuTitle.png",CCRectMake(0, 0, 133, 36) );
    
    title->setAnchorPoint( ccp(0.5, 1) );
    title->setPosition( ccp( getWinSize().width / 2 ,getWinSize().height -20 ) );
    this->addChild( title );
    
    //  加入menu-- 既是创建CCMenuItemToggle
    CCMenuItemToggle* music_trigger = CCMenuItemToggle::createWithTarget(this, menu_selector(OptionLayer::music_trigger_callback), CCMenuItemFont::create( "Music : On" ),CCMenuItemFont::create("Music : Off"),NULL);
    
    music_trigger->setPosition( ccp( getWinSize().width / 2 ,getWinSize().height / 2 ) );
    //  根据背景音乐播放与否来显示相关的文字选项
    
    if( SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying() )
    {
              
        music_trigger->setSelectedIndex( 1 );
        
    }
    else
    {
        music_trigger->setSelectedIndex( 0 );
        
    }
    
    //  创建后退的CCMenuItem
    CCLabelBMFont* fontOfBack = CCLabelBMFont::create("Go Back", "arial-14.fnt" );
    
    fontOfBack->setScale(1.5f);
    
    CCMenuItemLabel* backLabel = CCMenuItemLabel::create(fontOfBack, this, menu_selector(OptionLayer::back_callback));
    backLabel->setAnchorPoint( ccp( 0.5, 0 ) );
    backLabel->setPosition( ccp( getWinSize().width / 2, 30) );
    
    
    CCMenu* menu = CCMenu::create( music_trigger,backLabel,NULL);
    
    menu ->setPosition( CCPointZero );
//    menu->setPosition( ccp( getWinSize().width / 2, getWinSize().height /  2) );
    
    this->addChild( menu );
}
开发者ID:897290110,项目名称:MyMoonWarrior,代码行数:49,代码来源:OptionLayer.cpp

示例6: setViews

void OptionLayer::setViews()
{
	setBackGroundImage("loading.png");	

	CCSprite *title = CCSprite::create("menuTitle.png",CCRectMake(0,0,135,35));
	title->setAnchorPoint(ccp(0.5,1));
	title->setPosition(ccp(getWinSize().width/2,getWinSize().height-20));

	this->addChild(title);

	CCMenuItemToggle *music_trigger = CCMenuItemToggle::createWithTarget(this,menu_selector(OptionLayer::music_triggerCallback),
			CCMenuItemFont::create("Music : On"),CCMenuItemFont::create("Music : Off"),NULL);
	
	music_trigger->setPosition(ccp(getWinSize().width/2,getWinSize().height/2));


	if(SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying())
	{
		music_trigger->setSelectedIndex(1);
	}
	else
	{
		music_trigger->setSelectedIndex(0);
	}

	//menu->setPosition(ccp(getWinSize().width/2,getWinSize().height/2));

	CCLabelBMFont *back = CCLabelBMFont::create("back","arial-14.fnt");

	back->setScale(1.25f);
	CCMenuItemLabel *backLable =  CCMenuItemLabel::create(back,this,menu_selector(OptionLayer::backCallback));
	backLable->setAnchorPoint(ccp(0.5,1));
	backLable->setPosition(ccp(getWinSize().width/2,50));

	CCMenu *menu = CCMenu::create(music_trigger,backLable,NULL);
	menu->setPosition(CCPointZero);

	this->addChild(menu);
}
开发者ID:jinjianxin,项目名称:cocos2d-x,代码行数:39,代码来源:optionlayer.cpp

示例7: init

// on "init" you need to initialize your instance
bool TitleScene::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }
    
    CCSize size = CCDirector::sharedDirector()->getWinSize();

    CCSprite* pSprite = CCSprite::create("base/Title_Rush_Freak.png");
    pSprite->setTag(5000);
    
    // position the sprite on the center of the screen
    pSprite->setPosition( ccp(size.width/2, size.height*0.75f) );
    CCSequence *Scroll = CCSequence::create(CCEaseInOut::create(CCMoveBy::create(1.0, ccp(0,30)),1),
                                            CCEaseInOut::create(CCMoveBy::create(1.0,ccp(0,-30)),1),
                                            NULL);
    pSprite->runAction(CCRepeatForever::create(Scroll));
    
    
    CCLabelTTF * TapStringLabel = CCLabelTTF::create("タッチしてスタート", "Helvetica", 32);
    CCMenuItemLabel* LabelButton = CCMenuItemLabel::create(TapStringLabel, this, menu_selector(TitleScene::NextScene));
    CCMenu * StartMenu = CCMenu::create(LabelButton,NULL);
    this->addChild(StartMenu);

    StartMenu->setPosition(CCPointZero);
    
    //タップしてスタート
    LabelButton->setAnchorPoint(ccp(0.5f,0.5f));
    LabelButton->setPosition(ccp(size.width/2,size.height * 0.25f));
    
    // add the sprite as a child to this layer
    this->addChild(pSprite, 0);
    
    return true;
}
开发者ID:roripika,项目名称:rush_freak,代码行数:39,代码来源:TitleScene.cpp

示例8: init

// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }
    
    m_pAdmob = dynamic_cast<AdsAdmob*>(PluginManager::getInstance()->loadPlugin("AdsAdmob"));
    TAdsDeveloperInfo devInfo;
    devInfo["AdmobID"] = "a1516fb6b16b12f";
    m_pAdmob->configDeveloperInfo(devInfo);
    m_pListener = new MyAdsListener();
    m_pAdmob->setAdsListener(m_pListener);
    m_pAdmob->setDebugMode(true);

    CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
    CCPoint posMid = ccp(origin.x + visibleSize.width / 2, origin.y + visibleSize.height / 2);

    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.

    // add a "close" icon to exit the progress. it's an autorelease object
    CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
                                        "CloseNormal.png",
                                        "CloseSelected.png",
                                        this,
                                        menu_selector(HelloWorld::menuCloseCallback));
    
	pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 ,
                                origin.y + pCloseItem->getContentSize().height/2));

    // create menu, it's an autorelease object
    CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
    pMenu->setPosition(CCPointZero);

	CCLabelTTF* label1 = CCLabelTTF::create("ShowAds", "Arial", 24);
	CCMenuItemLabel* pItemShow = CCMenuItemLabel::create(label1, this, menu_selector(HelloWorld::testShow));
	pItemShow->setAnchorPoint(ccp(0.5f, 0));
	pMenu->addChild(pItemShow, 0);
	pItemShow->setPosition(ccpAdd(posMid, ccp(-100, -120)));

	CCLabelTTF* label2 = CCLabelTTF::create("HideAds", "Arial", 24);
	CCMenuItemLabel* pItemHide = CCMenuItemLabel::create(label2, this, menu_selector(HelloWorld::testHide));
	pItemHide->setAnchorPoint(ccp(0.5f, 0));
	pMenu->addChild(pItemHide, 0);
	pItemHide->setPosition(ccpAdd(posMid, ccp(100, -120)));

	// create optional menu
	// cases item
	m_pCaseItem = CCMenuItemToggle::createWithTarget(this,
												menu_selector(HelloWorld::caseChanged),
												CCMenuItemFont::create( s_aTestCases[0].c_str() ),
												NULL );
	int caseLen = sizeof(s_aTestCases) / sizeof(std::string);
	for (int i = 1; i < caseLen; ++i)
	{
		m_pCaseItem->getSubItems()->addObject( CCMenuItemFont::create( s_aTestCases[i].c_str() ) );
	}
	m_pCaseItem->setPosition(ccpAdd(posMid, ccp(-200, 120)));
	pMenu->addChild(m_pCaseItem);

	// type item
	m_pTypeItem = CCMenuItemToggle::createWithTarget(this,
												menu_selector(HelloWorld::typeChanged),
												CCMenuItemFont::create( s_aTestTypes[0].c_str() ),
												NULL );
	int typeLen = sizeof(s_aTestTypes) / sizeof(std::string);
	for (int i = 1; i < typeLen; ++i)
	{
		m_pTypeItem->getSubItems()->addObject( CCMenuItemFont::create( s_aTestTypes[i].c_str() ) );
	}
	m_pTypeItem->setPosition(ccpAdd(posMid, ccp(0, 120)));
	pMenu->addChild(m_pTypeItem);

	// poses item
	m_pPosItem = CCMenuItemToggle::createWithTarget(this,
												menu_selector(HelloWorld::posChanged),
												CCMenuItemFont::create( s_aTestPoses[0].c_str() ),
												NULL );
	int posLen = sizeof(s_aTestPoses) / sizeof(std::string);
	for (int i = 1; i < posLen; ++i)
	{
		m_pPosItem->getSubItems()->addObject( CCMenuItemFont::create( s_aTestPoses[i].c_str() ) );
	}
	m_pPosItem->setPosition(ccpAdd(posMid, ccp(200, 120)));
	pMenu->addChild(m_pPosItem);

	// init options
	m_pAds = m_pAdmob;
	m_ePos = ProtocolAds::kPosCenter;
	m_eType = ProtocolAds::kBannerAd;

    this->addChild(pMenu, 1);

    return true;
//.........这里部分代码省略.........
开发者ID:richy486,项目名称:cocos2d-x,代码行数:101,代码来源:HelloWorldScene.cpp

示例9: init

// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }

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

    CCSprite* pBackground = CCSprite::create("background.png");
    pBackground->setPosition(ccp(size.width / 2, size.height / 2));
    addChild(pBackground);
    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.

    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
    CCPoint posBR = ccp(pEGLView->getVisibleOrigin().x + pEGLView->getVisibleSize().width, pEGLView->getVisibleOrigin().y);
    CCPoint posTL = ccp(pEGLView->getVisibleOrigin().x, pEGLView->getVisibleOrigin().y + pEGLView->getVisibleSize().height);

    // add a "close" icon to exit the progress. it's an autorelease object
    CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
                                        "CloseNormal.png",
                                        "CloseSelected.png",
                                        this,
                                        menu_selector(HelloWorld::menuCloseCallback) );
    pCloseItem->setPosition( ccp(posBR.x - 20, posBR.y + 20) );

    // create menu, it's an autorelease object
    CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
    pMenu->setPosition( CCPointZero );
    this->addChild(pMenu, 1);

    CCPoint posStep = ccp(220, -150);
    CCPoint beginPos = ccpAdd(posTL, ccpMult(posStep, 0.5f));
    int line = 0;
    int row = 0;
    for (int i = 0; i < sizeof(s_EventMenuItem)/sizeof(s_EventMenuItem[0]); i++) {
    	CCMenuItemImage* pMenuItem = CCMenuItemImage::create(s_EventMenuItem[i].id.c_str(), s_EventMenuItem[i].id.c_str(),
    			this, menu_selector(HelloWorld::eventMenuCallback));
        pMenu->addChild(pMenuItem, 0, s_EventMenuItem[i].tag);

        CCPoint pos = ccpAdd(beginPos, ccp(posStep.x * row, posStep.y * line));
        CCSize itemSize = pMenuItem->getContentSize();
        if ((pos.x + itemSize.width / 2) > posBR.x)
		{
			line += 1;
			row = 0;
			pos = ccpAdd(beginPos, ccp(posStep.x * row, posStep.y * line));
		}
        row += 1;
        pMenuItem->setPosition(pos);
    }

    CCLabelTTF* label = CCLabelTTF::create("reload all plugins", "Arial", 24);
    CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(HelloWorld::reloadPluginMenuCallback));
    pMenuItem->setAnchorPoint(ccp(0.5f, 0));
    pMenu->addChild(pMenuItem, 0);
    pMenuItem->setPosition( ccp(size.width / 2, 0));

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

示例10: CCSizeMake

NS_CC_EXT_BEGIN

#define NUM_PER_PAGE    4

CCTextureWatcher::CCTextureWatcher()
{
    m_bHide = false;
    m_nCurrnetPage = 1;
    m_nTotalPage = 0;
    m_bFresh = true;
    m_pTextures = NULL;
    m_pszString = NULL;
    m_pLayer = CCLayerColor::layerWithColor(ccc4(128, 128, 128, 128));
    m_pLayer->retain();

    // layer
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    size.height *= 0.6;
    m_pLayer->setContentSize(size);

    // the menu of disabling touch event
    //*
    CCLabelTTF *label = CCLabelTTF::labelWithString(" ", size, CCTextAlignmentLeft, "Arial", 12);
    CCMenuItemLabel *menuItem = CCMenuItemLabel::itemWithLabel(label);
    menuItem->setAnchorPoint(ccp(0, 0));
    menuItem->setPosition(ccp(0, 0));
        
    CCMenu *menu = CCMenu::menuWithItem(menuItem);
    menu->setAnchorPoint(ccp(0, 0));
    menu->setPosition(ccp(0, 0));
    m_pLayer->addChild(menu);
    //*/

    // list
    CCListView *list = CCListView::viewWithMode(CCListViewModeHorizontal);
    list->setContentSize(size);
    list->setDelegate(this);
    list->setSeparatorStyle(CCListViewCellSeparatorStyleNone);
    m_pLayer->addChild(list);
    m_pList = list;


    // 'Hide' button
    CCLabelTTF *labelHide = CCLabelTTF::labelWithString("Hide  ", "Arial", 24);
    labelHide->setColor(ccc3(255, 0, 0));
    CCMenuItemLabel *menuItem2 = CCMenuItemLabel::itemWithLabel(labelHide, this, menu_selector(CCTextureWatcher::actionHide));
    menuItem2->setAnchorPoint(ccp(0, 0));
    menuItem2->setPosition(ccp(0, 0));

    CCMenu *menu2 = CCMenu::menuWithItem(menuItem2);
    menu2->setAnchorPoint(ccp(0, 0));
    menu2->setPosition(ccp(size.width - menuItem2->getContentSize().width, 0));

    m_labelHide = labelHide;
    m_menuHide = menu2;
    m_menuHide->retain();

    // 'Fresh' button
    CCLabelTTF *labelFresh = CCLabelTTF::labelWithString("Fresh", "Arial", 24);
    labelFresh->setColor(ccc3(255, 0, 0));
    CCMenuItemLabel *menuItem1 = CCMenuItemLabel::itemWithLabel(labelFresh, this, menu_selector(CCTextureWatcher::actionFresh));
    menuItem1->setAnchorPoint(ccp(0, 0));
    menuItem1->setPosition(ccp(0, 0));

    CCMenu *menu1 = CCMenu::menuWithItem(menuItem1);
    menu1->setAnchorPoint(ccp(0, 0));
    menu1->setPosition(ccp(size.width - menuItem1->getContentSize().width - menuItem2->getContentSize().width * 1.5, 0));
    m_pLayer->addChild(menu1);
    
    // label page
    m_labelPage = CCLabelTTF::labelWithString(" ", CCSizeMake(size.width * 0.1, labelFresh->getContentSize().height), CCTextAlignmentCenter, "Arial", 16);
    m_labelPage->setAnchorPoint(ccp(0.5, 0));
    m_labelPage->setPosition(ccp(size.width/2.0, 0));
    m_pLayer->addChild(m_labelPage, 0);
}
开发者ID:Aaron-Teng,项目名称:AnalyticX,代码行数:75,代码来源:CCTextureWatcher.cpp

示例11: init

bool MapControlLayer::init()
{
    if ( !CCLayerColor::init() )
    {
        return false;
    }
    
    removeAllChildrenWithCleanup(true);
    
    CCSize screenSize = GameParams::getInstanse()->screenSize;
    sizeHeight = 200;
    showed = false;
    layersCnt_ = 0;
    
    m_bTouchEnabled = true;
    
    CCLabelTTF * mapLabel = CCLabelTTF::create("Карта", "Marker Felt", 22);
    mapLabel->setAnchorPoint(ccp(0,1));
    mapLabel->setPosition(ccp(25,sizeHeight-5));
    
    CCLabelTTF * layers = CCLabelTTF::create("Слои", "Marker Felt", 18);
    layers->setAnchorPoint(ccp(0,1));
    layers->setPosition(ccp(25,sizeHeight-35));
    
    CCMenuItemLabel* layersPlus = CCMenuItemLabel::create(CCLabelTTF::create("+", "Marker Felt", 18),this,menu_selector(MapControlLayer::plusLayers));
    layersPlus->setAnchorPoint(ccp(0,1));
    layersPlus->setPosition(ccp(135,sizeHeight-35));
    
    CCMenuItemLabel* layersMinus = CCMenuItemLabel::create(CCLabelTTF::create("-", "Marker Felt", 18),this,menu_selector(MapControlLayer::minusLayers));
    layersMinus->setAnchorPoint(ccp(0,1));
    layersMinus->setPosition(ccp(95,sizeHeight-35));
    
    layersCnt = CCLabelTTF::create("1", "Marker Felt", 18);
    layersCnt->setAnchorPoint(ccp(0,1));
    layersCnt->setPosition(ccp(110,sizeHeight-35));
    
    
    CCLabelTTF * tileset = CCLabelTTF::create("Тайлсет", "Marker Felt", 18);
    tileset->setAnchorPoint(ccp(0,1));
    tileset->setPosition(ccp(25,sizeHeight-65));
    
    CCMenuItemLabel* tilesetPlus = CCMenuItemLabel::create(CCLabelTTF::create("+", "Marker Felt", 18),this,menu_selector(MapControlLayer::plusTileset));
    tilesetPlus->setAnchorPoint(ccp(0,1));
    tilesetPlus->setPosition(ccp(135,sizeHeight-65));
    
    CCMenuItemLabel* tilesetMinus = CCMenuItemLabel::create(CCLabelTTF::create("-", "Marker Felt", 18),this,menu_selector(MapControlLayer::minusTileset));
    tilesetMinus->setAnchorPoint(ccp(0,1));
    tilesetMinus->setPosition(ccp(95,sizeHeight-65));
    
    tilesetCnt = CCLabelTTF::create("1", "Marker Felt", 18);
    tilesetCnt->setAnchorPoint(ccp(0,1));
    tilesetCnt->setPosition(ccp(110,sizeHeight-65));
    
    
    
    CCMenuItemLabel* SaveMap = CCMenuItemLabel::create(CCLabelTTF::create("Сохранить!", "Marker Felt", 22),this,menu_selector(MapControlLayer::SaveMap));
    SaveMap->setColor(ccc3(20, 200, 20));
    SaveMap->setAnchorPoint(ccp(0,1));
    SaveMap->setPosition(ccp(35,sizeHeight-95));
    
    CCMenuItemLabel* closeMap = CCMenuItemLabel::create(CCLabelTTF::create("Закрыть", "Marker Felt", 22),this,menu_selector(MapControlLayer::CloseMap));
    closeMap->setColor(ccc3(20, 20, 200));
    closeMap->setAnchorPoint(ccp(0,1));
    closeMap->setPosition(ccp(35,sizeHeight-125));
    
    CCMenuItemLabel* deleteMap = CCMenuItemLabel::create(CCLabelTTF::create("Удалить", "Marker Felt", 22),this,menu_selector(MapControlLayer::DeleteMap));
    deleteMap->setColor(ccc3(200, 20, 20));
    deleteMap->setAnchorPoint(ccp(0,1));
    deleteMap->setPosition(ccp(35,sizeHeight-155));
    
    setColor(ccc3(144,144,144));
    setOpacity(220);
    
    setContentSize(CCSizeMake(screenSize.width-GameParams::getInstanse()->programLayerWidth,sizeHeight));
    
    arrow = CCMenuItemImage::create("System/down.png", "System/down.png",this, menu_selector(MapControlLayer::showLayer));
    CCMenu * menu = CCMenu::create(arrow, SaveMap, closeMap, deleteMap, layersPlus, layersMinus, tilesetPlus, tilesetMinus, NULL);
    
    arrow->setAnchorPoint(ccp(0.5,1));
    arrow->setPosition(ccp((screenSize.width-GameParams::getInstanse()->programLayerWidth)/2,0));
    
    menu->setPosition(CCPointZero);
    menu->retain();
    addChild(menu,2);
    
    addChild(mapLabel,2);
    addChild(layers,2);
    addChild(tileset,2);
    
    addChild(layersCnt,2);
    addChild(tilesetCnt,2);
    
    // robots
    
    robotsPrefs = RobotPrefsScrolLayer::getInstanse();
    robotsPrefs->setContentSize(CCSizeMake(screenSize.width-GameParams::getInstanse()->programLayerWidth - 200,sizeHeight));
    robotsPrefs->setPosition(ccp(200,0));
    robotsPrefs->frame = CCRectMake(200, 0, screenSize.width-GameParams::getInstanse()->programLayerWidth - 200, sizeHeight);
    
//    Robot4Edit * robot4Edit = Robot4Edit::create();
//.........这里部分代码省略.........
开发者ID:misty-fungus,项目名称:piktomir,代码行数:101,代码来源:MapControl.cpp


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