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


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

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


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

示例1: startGame

void TetrisGameLayer::startGame(){
    
    G_current_HandleType = new LongBlock_Type();
    G_current_HandleType->init();
    
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    //控制按钮//
    CCMenuItemImage * left = CCMenuItemImage::create("left.png", "left.png");
    left->setTarget(this, menu_selector(TetrisGameLayer::leftButtonPressed));
    left->setScale(0.5);
    CCMenuItemImage * right = CCMenuItemImage::create("right.png", "right.png");
    right->setTarget(this, menu_selector(TetrisGameLayer::rightButtonPressed));
    left->setAnchorPoint(ccp(0, 0));
    right->setAnchorPoint(ccp(0, 0));
    right->setScale(0.5);
    right->setPosition(ccp(size.width/2+size.width/4, 0));
    
    CCMenuItemImage * down = CCMenuItemImage::create("down.png", "down.png");
    down->setTarget(this, menu_selector(TetrisGameLayer::downButtonPressed));
    down->setAnchorPoint(ccp(0,0));
    down->setScale(0.5);
    down->setPosition(ccp(size.width/2 -100,0));
    down->setOpacity(0.7*255);
    
    CCMenu * menu = CCMenu::create(left,down,right, NULL);
    menu->setAnchorPoint(ccp(0, 0));
    menu->setPosition(ccp(0, 0));
    this->addChild(menu);
}
开发者ID:zzh442856860,项目名称:eluosi,代码行数:29,代码来源:TetrisGameLayer.cpp

示例2: addChild

LoginUI::LoginUI(SEL_MenuHandler loginSelector, SEL_MenuHandler joinSelector, CCObject *pTarget, int fontSize)
{
    m_pBackGround = new CCSprite;
    m_pBackGround->initWithFile("Login-Background.png");
    m_pBackGround->setPosition(ccp(-10, -10));
    m_pBackGround->setAnchorPoint(ccp(0, 0));
    
    addChild(m_pBackGround);
    
    for(int i=0; i<LOGIN_UI_ENUM_NUM; ++i)
    {
        m_pTextField[i] = new CCTextFieldTTF;
        m_pTextField[i]->initWithPlaceHolder("", LOGIN_UI_FONT_NAME, fontSize);
        m_pTextField[i]->setAnchorPoint(ccp(0,0));
        m_pTextField[i]->setColor(ccc3(0, 0, 0));
        m_pTextField[i]->setHorizontalAlignment(kCCTextAlignmentLeft);
        m_pTextField[i]->setContentSize(LOGIN_UI_TEXTFILED_SIZE);
        m_pTextField[i]->setDelegate(this);
        
        m_pLabel[i] = new CCLabelTTF;
        m_pLabel[i]->initWithString("", LOGIN_UI_FONT_NAME, fontSize);
        m_pLabel[i]->setColor(ccc3(0, 0, 0));
        m_pLabel[i]->setAnchorPoint(ccp(0,0));
        
        addChild(m_pTextField[i]);
        addChild(m_pLabel[i]);
    }
    
    m_pLabel[LOGIN_UI_ENUM_ID]->setString("ID : ");
    m_pLabel[LOGIN_UI_ENUM_ID]->setPosition(ccp(10,110));
    
    m_pLabel[LOGIN_UI_ENUM_PW]->setString("PW : ");
    m_pLabel[LOGIN_UI_ENUM_PW]->setPosition(ccp(10, 70));

    m_pTextField[LOGIN_UI_ENUM_ID]->setPosition(ccp(50, 110));
    m_pTextField[LOGIN_UI_ENUM_PW]->setPosition(ccp(50, 70));
    
    CCMenuItemImage *pBtLogin = CCMenuItemImage::create("Button/Login-Login.png", "Button/Login-Login.png", pTarget, loginSelector);
    
    pBtLogin->setPosition(ccp(150,10));
    pBtLogin->setAnchorPoint(ccp(0,0));
    
    CCMenuItemImage *pBtJoin = CCMenuItemImage::create("Button/Login-SignUp.png", "Button/Login-SignUp.png", pTarget, joinSelector);
    
    pBtJoin->setPosition(ccp(230,10));
    pBtJoin->setAnchorPoint(ccp(0,0));
        
    m_pMenu = CCMenu::create(pBtLogin, pBtJoin, NULL);
    m_pMenu->setAnchorPoint(ccp(0,0));
    m_pMenu->setPosition(ccp(0,0));
    
    addChild(m_pMenu);
    
    setTouchEnabled(true);
    
    setContentSize(m_pBackGround->getContentSize());
}
开发者ID:ChungH,项目名称:MobileSNG,代码行数:57,代码来源:LoginUI.cpp

示例3: initButton

void MarketScene::initButton()
{
	CCMenuItemImage *pMenuItem = CCMenuItemImage::create(s_pMenuItemBack.charMapFile, s_pMenuItemBack.charMapFilePress, this, menu_selector(MarketScene::buttonCallback));
	if (NULL != pMenuItem)
	{
		pMenuItem->setAnchorPoint(ccp(1,1));
		pMenuItem->setPosition(SCREEN);
		pMenuItem->setTag(BTN_CLOSE);
	}
	CCMenu *pMenu = CCMenu::create(pMenuItem, NULL);
	if (NULL != pMenu)
	{
		pMenu->setPosition(CCPointZero);
		addChild(pMenu);
		pMenu->setTag(TAG_MENU);
	}

	pMenuItem = CCMenuItemImage::create(s_pMenuItemBuy.charMapFile, s_pMenuItemBuy.charMapFilePress, s_pBuyDisable, this, menu_selector(MarketScene::buttonCallback));
	pMenuItem->setAnchorPoint(ccp(0.5f, 0.5f));
	pMenuItem->setPosition(ccp(CENTER.x, 120));
	pMenuItem->setTag(BTN_BUY);
	pMenu->addChild(pMenuItem);

	char szFileName[32] = { 0 };
	char szFileName2[32] = { 0 };
	char szFileName3[32] = { 0 };
	for (int i = 0; i < CARD_COUNT; i++)
	{
		sprintf(szFileName, s_pathCard.charMapFile, i);
		sprintf(szFileName2, s_pathCard.charMapFilePress, i);
		sprintf(szFileName3, s_pathCardDisable, i);

		CCMenuItemImage *pItem0 = CCMenuItemImage::create(szFileName, szFileName2, szFileName3);
		CCMenuItemImage *pItem1 = CCMenuItemImage::create(szFileName2, szFileName);
		CCMenuItemToggle *pToggle = CCMenuItemToggle::createWithTarget(this, menu_selector(MarketScene::buttonCallback), pItem0, pItem1, NULL);
		pToggle->setPosition(ccp(120 * i + s_pathCard.m_Position.x, s_pathCard.m_Position.y));
		pToggle->setTag(BTN_CARD + i);

		if (g_Control.cards[i] > 0)
		{
			CCSprite *sprite = CCSprite::create(s_pathCardbuy.m_strPath);
			sprite->setPosition(s_pathCardbuy.m_Position);
			pToggle->addChild(sprite, TAG_CARD_BUY, TAG_CARD_BUY);
		}

		pMenu->addChild(pToggle);
	}
	checkCard(BTN_CARD);
}
开发者ID:hyper123,项目名称:TurboSnail,代码行数:49,代码来源:MarketScene.cpp

示例4: showTimerBoarder

CCLayer* GameScene::showTimerBoarder()
{
	CCLayer* board = CCLayer::create();
	CCSprite* boardBG = CCSprite::create("header.png");
	boardBG->setPosition(ccp(320,0));
	boardBG->setAnchorPoint(ccp(0.5f,0));
	board->addChild(boardBG);
	CCMenuItemImage* imageItem = CCMenuItemImage::create("btn-pause.png","btn-pause-down.png", this,menu_selector(GameScene::restartScene));
	imageItem->setAnchorPoint(ccp(0,1));
	CCMenu* menu = CCMenu::create(imageItem,NULL);
	menu->setAnchorPoint(ccp(0,1));
	menu->setPosition(ccp(0,158));
	pr = CCProgressTimer::create(CCSprite::create("timer.png"));
	pr->setPosition(ccp(320,16));
	pr->setAnchorPoint(ccp(0.5,0));
	pr->setPercentage(1.0f);
	pr->setType(kCCProgressTimerTypeBar);
	pr->setMidpoint(ccp(1,0));
	pr->setBarChangeRate(ccp(1,0));
	this->schedule(schedule_selector(GameScene::countTime),1.0f);

	scoreTxt = CCLabelBMFont::create("0","fonts/scorefont.fnt");
	scoreTxt->setAnchorPoint(ccp(1,0.5f));
	scoreTxt->setScale(1.0f);
	scoreTxt->setAlignment(kCCTextAlignmentRight);
	scoreTxt->setPosition(ccp(640,110));
	board->addChild(scoreTxt,10);
	board->addChild(pr);
	board->addChild(menu);
	return board;
}
开发者ID:holybomb,项目名称:CrystalGame,代码行数:31,代码来源:GameScene.cpp

示例5: init

bool InstructionsLayer::init()
{
    // Back item
    CCMenuItemImage *pBackItem = CCMenuItemImage::itemFromNormalImage(
                                        "quit.png",
                                        "quit-hover.png",
                                        this,
                                        menu_selector(InstructionsLayer::back));
    pBackItem->setAnchorPoint( ccp(0.5, 0.5) );
    pBackItem->setPosition( ccp(CCDirector::sharedDirector()->getWinSize().width/2, 50) );


    // Create menu
    CCMenu* pMenu = CCMenu::menuWithItems(pBackItem, NULL);
    pMenu->setPosition( CCPointZero );
    this->addChild(pMenu, 1);


    // Label
    CCLabelTTF* pLabel = CCLabelTTF::labelWithString("About", "Arial", 24);
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    pLabel->setPosition( ccp(size.width / 2, size.height - 50) );
    this->addChild(pLabel, 1);

    return true;
}
开发者ID:warchiefmarkus,项目名称:Rogue-World,代码行数:26,代码来源:InstructionsLayer.cpp

示例6: init

bool UpgradeScene::init() {

	if (!CCLayerColor::initWithColor(ccc4(0, 0, 0, 100))) {
		return false;
	}

//	if(!CCLayer::init()) {
//		return false;
//	}

// 开启触控
	setTouchEnabled(true);

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

	CCMenuItemImage *img = CCMenuItemImage::create("Night-Vision_01.png",
			"Night-Vision_01.png");
	img->setAnchorPoint(ccp(0.5, 0.5));
	img->setPosition(ccp(winSize.width/2, winSize.height/2));

	menu = CCMenu::create(img, NULL);
	menu->setAnchorPoint(ccp(0.5, 0.5));
	menu->setPosition(CCPointZero);
	addChild(menu, 1, 10);

	return true;
}
开发者ID:frankiefanstar,项目名称:YShoot,代码行数:27,代码来源:UpgradeScene.cpp

示例7: CreateGroupGameRoom

void CGroupInfoScene::CreateGroupGameRoom()
{
	// 最后一个为新加的,draw it
	vector<CGameRoomInfo> &rooms = CGameManager::Instance().GetGameRoomInfo();

	CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
	float w = visibleSize.width/ 2;
	float h = visibleSize.height - 120;

	CCMenuItemImage *pAddItem = CCMenuItemImage::create(
		PATCH_RES_DIR("group_room.png"),
		PATCH_RES_DIR("group_room.png"),
		this,
		menu_selector(CGroupInfoScene::menuEnterGroupGameRoomCallback) );

	h -= (rooms.size()-1) * (pAddItem->getContentSize().height + 5);

	pAddItem->setAnchorPoint( ccp(0, 0) );
	pAddItem->setPosition( ccp(w, h) );
	pAddItem->setUserData( &rooms[rooms.size()-1] );

	CCMenu *pMenu = CCMenu::create( pAddItem, NULL );
	pMenu->setPosition( CCPointZero );
	addChild( pMenu, 1 );
}
开发者ID:mjssw,项目名称:myproj,代码行数:25,代码来源:GroupInfoScene.cpp

示例8: init

bool HelpScene::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }

    setKeypadEnabled(true);

    LayoutManager *layoutManager = LayoutManager::getInstance();
    CCRect visibleRect = layoutManager->getVisibleRect();

    CCDirector *director = CCDirector::sharedDirector();
    m_Background = CCSprite::create("help.png");
    m_Background->retain();
    m_Background->setPosition(director->getVisibleOrigin() + director->getVisibleSize() / 2);
    addChild(m_Background);

    CCMenuItemImage *pBack = CCMenuItemImage::create("back.png", NULL, this, menu_selector(HelpScene::backCallback));
    pBack->setAnchorPoint(CCPointZero);
    pBack->setPosition(ccp(visibleRect.origin.x + 18, visibleRect.origin.y + 12));

    CCMenu *pMenu = CCMenu::create(pBack, NULL);
    pMenu->setAnchorPoint(CCPointZero);
    pMenu->setPosition(CCPointZero);
    addChild(pMenu);

    return true;
}
开发者ID:studio501,项目名称:BlockPuzzle,代码行数:31,代码来源:HelpScene.cpp

示例9: init

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

    //
    menuArray = new CCArray();
    menuArray->retain();
    menuArray->addObject(CCString::createWithFormat("3DBox Test"));
    menuArray->addObject(CCString::createWithFormat("Box2D Test"));

    
    CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();

    /////////////////////////////
    // 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->setAnchorPoint(ccp(1, 0));
	pCloseItem->setPosition(VisibleRect::rightBottom());

    // create menu, it's an autorelease object
    CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
    pMenu->setPosition(CCPointZero);
    this->addChild(pMenu, 1);
    
 
    // add "HelloWorld" splash screen"
    CCSprite* background = CCSprite::create("star.png");
    background->setAnchorPoint(ccp(0.5, 0.5));
    background->setPosition(VisibleRect::center());
    this->addChild(background, 0);

    CCTableView *tableView=CCTableView::create(this, CCSizeMake(300, visibleSize.height));
    tableView->setDirection(kCCScrollViewDirectionVertical);
    tableView->setAnchorPoint(ccp(0.5, 0));
    tableView->setPosition(ccp(visibleSize.width/2 + origin.x, 0));
    tableView->setDelegate(this);
    tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
    this->addChild(tableView,1);
    tableView->reloadData();

    return true;
}
开发者ID:shazi129,项目名称:MyCocoDemo,代码行数:57,代码来源:HelloWorldScene.cpp

示例10: init

bool CSettingScene::init(void)
{
	//////////////////////////////
    // 1. super init first
	if ( !CCScene::init() )
    {
        return false;
    }

	CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();

    // 광고 켜기
    gene::AdMobObjectCPP * admob = new gene::AdMobObjectCPP();
    admob->showAdMob();
    
	/////////////////////////////
    // 2. add layers
	CCLayer* BackgroundLayer = CBackgroundLayer::create();

	this->addChild(BackgroundLayer, 0);

	//add Setting Title
	CCSprite* pTitle = CCSprite::create(SETTING_TITLE.c_str());
    pTitle->setAnchorPoint(ccp(0,0));
	pTitle->setPosition(CCPoint(SETTING_TITLE_POS));
	addChild(pTitle,1);


	m_SettingMenuLayer = CSettingMenuLayer::create();

	this->addChild(m_SettingMenuLayer, 1);

	//add custom backBtn
	CCMenuItemImage *pBackToMainButton = CCMenuItemImage::create(
		SHARED_BTN_BACK.c_str(),
		SHARED_BTN_BACK.c_str(),
		this,
		menu_selector(CSettingScene::MainSceneCallback)
		);

	pBackToMainButton->setAnchorPoint(ccp(0,0));
	CCMenu* pMenu = CCMenu::create(pBackToMainButton, NULL);
	pMenu->setPosition(SHARED_BTN_BACK_POS);
	addChild(pMenu, 1);



	/////////////////////////////
	// 3. active schedule
	this->scheduleUpdate();

	// 5. initial update
	CGameManager::GetInstance()->SetUpdateFlag(true);

	return true;
}
开发者ID:junggang,项目名称:blackbags,代码行数:56,代码来源:SettingScene.cpp

示例11: createPauseLayer

void GameLayer::createPauseLayer() {
	Context *context = Context::sharedContext();
	CCSize s = CCDirector::sharedDirector()->getWinSize();
	/* 半透明层 */
	CCLayerColor* pauseLayer = CCLayerColor::create();
	pauseLayer->setContentSize(CCSizeMake(s.width, s.height));
	pauseLayer->setColor(ccc3(0, 0, 0));
	pauseLayer->setOpacity(150);
	CCMenu *menu = CCMenu::create();
//回到游戏
	CCMenuItemImage *resumebg = CCMenuItemImage::create(("btn_big.png"),
			("btn_big.png"));
	resumebg->setTarget(this, menu_selector(GameLayer::onResumeItem));
	CCMenuItemFont *resumetxt = CCMenuItemFont::create(LOCAL_RESOURCES->valueByKey("i18n_resume")->getCString());
	resumebg->setAnchorPoint(ccp(0.5, 0.5));
	resumebg->setPosition(ccpp(0, 0));
	resumetxt->setPosition(
			ccp(resumebg->getContentSize().width / 2,
					resumebg->getContentSize().height / 2));
	resumetxt->setAnchorPoint(ccp(0.5, 0.5));
	resumetxt->setColor(context->getFontColor());
	resumebg->addChild(resumetxt);
	menu->addChild(resumebg);

//回到菜单
	CCMenuItemImage *backbg = CCMenuItemImage::create(("btn_big.png"),
			("btn_big.png"));
	backbg->setTarget(this, menu_selector(GameLayer::onBackItem));
	CCMenuItemFont *backtxt = CCMenuItemFont::create(LOCAL_RESOURCES->valueByKey("i18n_back")->getCString());
	backbg->setAnchorPoint(ccp(0.5, 0.5));
	backbg->setPosition(ccpp(0, -0.12));
	backtxt->setPosition(
			ccp(backbg->getContentSize().width / 2,
					backbg->getContentSize().height / 2));
	backtxt->setAnchorPoint(ccp(0.5, 0.5));
	backtxt->setColor(context->getFontColor());
	backbg->addChild(backtxt);
	menu->addChild(backbg);

	pauseLayer->addChild(menu);
	CCDirector::sharedDirector()->getRunningScene()->addChild(pauseLayer, 0,
	TAG_LAYER_PAUSE);
}
开发者ID:beforeeight,项目名称:sort,代码行数:43,代码来源:GameScene.cpp

示例12: init

bool CContactScene::init(void)
{
	//////////////////////////////
    // 1. super init first
	if ( !CCScene::init() )
    {
        return false;
    }
    
    CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    
    // 광고 끄기
    gene::AdMobObjectCPP * admob = new gene::AdMobObjectCPP();
    admob->hideAdMob();
    
	/////////////////////////////
    // 2. add layers
	CCLayer* BackgroundLayer = CBackgroundLayer::create();
	this->addChild(BackgroundLayer, 0);
    
    CCSprite* ContactTitle = CCSprite::create(CONTACT_TITLE.c_str());
    ContactTitle->setAnchorPoint(ccp(0,0));
    ContactTitle->setPosition(CCPoint(CONTACT_TITLE_POS));
    addChild(ContactTitle,0);

    //add backgroundImg
	CCSprite* pBackground = CCSprite::create(SETTING_BG.c_str());
	pBackground->setAnchorPoint(ccp(0,0));
	pBackground->setPosition(CCPoint(SETTING_BG_POS));
	addChild(pBackground,1);
    
    //add mail
    CCSprite* pMail = CCSprite::create(CONTACT_MAIL.c_str());
	pMail->setPosition(ccp(visibleSize.width/2,visibleSize.height/2));
	addChild(pMail,1);
    
    //add custom backBtn
	CCMenuItemImage *pBackToMainButton = CCMenuItemImage::create(
         SHARED_BTN_BACK.c_str(),
         SHARED_BTN_BACK.c_str(),
         this,
         menu_selector(CContactScene::SettingSceneCallback)
         );
    
	pBackToMainButton->setAnchorPoint(ccp(0,0));
	CCMenu* pMenu = CCMenu::create(pBackToMainButton, NULL);
	pMenu->setPosition(SHARED_BTN_BACK_POS);
	addChild(pMenu, 1);
    
    
    
    
	return true;
}
开发者ID:junggang,项目名称:blackbags,代码行数:54,代码来源:ContactScene.cpp

示例13:

CCMenuItemImage* Objects2dFactory::imageButton(CCNode* scene, CCMenu* menu, string normalImagePath, string selectedImagePath, string disabledImagePath, 
	float positionX, float positionY, float width, float height, SEL_MenuHandler selector, void* selectorArg, AlignX alignX, AlignY alignY, int zOrder)
{
	// Check arguments validity
	if(scene == NULL || menu == NULL || !selector)
		return NULL;

	// Create a button menu item
    CCMenuItemImage *button = CCMenuItemImage::create(
        normalImagePath.c_str(),
        selectedImagePath.c_str(),
        disabledImagePath.c_str(),
        scene,
        selector);
    if(!button)
		return NULL;

	if (selectorArg != NULL)
	{
		button->setUserData(selectorArg);
	}

    // Place the menu item in the given position
    button->setPosition(ccp(positionX, positionY));

	// Set anchor
	button->setAnchorPoint(ccp(Constants::getAnchorValue(alignX), Constants::getAnchorValue(alignY)));
	
	// Set menu item width
	float buttonWidth = button->boundingBox().size.width;
	if (width > 0) // if width is defined, it is setted
	{
		button->setScaleX(width / buttonWidth);
	}

	// Set menu item height
	float buttonHeight = button->boundingBox().size.height;
	if (height > 0) // if height is defined, it is setted
	{
		button->setScaleY(height / buttonHeight);
	}

	// Add button to the menu
	menu->addChild(button, zOrder);

	return button;
}
开发者ID:Cnotinfor,项目名称:TopQX_2D,代码行数:47,代码来源:Objects2dFactory.cpp

示例14: _InitAddGame

void CGroupInfoScene::_InitAddGame()
{
	CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
	CCMenuItemImage *pAddItem = CCMenuItemImage::create(
		PATCH_RES_DIR("add.png"),
		PATCH_RES_DIR("add.png"),
		this,
		menu_selector(CGroupInfoScene::menuAddGameCallback) );
	pAddItem->setAnchorPoint( ccp(0, 0) );
	float w = visibleSize.width - pAddItem->getContentSize().width - 5;
	float h = visibleSize.height - 100;
	pAddItem->setPosition( ccp(w, h) );

	CCMenu *pMenu = CCMenu::create( pAddItem, NULL );
	pMenu->setPosition( CCPointZero );
	addChild( pMenu, 1 );
}
开发者ID:mjssw,项目名称:myproj,代码行数:17,代码来源:GroupInfoScene.cpp

示例15:

CCLayer * GameLayer::createPauseButtonLayer() {
	CCMenu *layer = CCMenu::create();
	//暂停
	CCMenuItemImage *pausebg = CCMenuItemImage::create(("btn_small.png"),
			("btn_small.png"));
	CCSprite *pausetxt = CCSprite::create("btn_pause.png");
	pausebg->setTarget(this, menu_selector(GameLayer::onPauseItem));
	pausebg->setAnchorPoint(ccp(0, 0.5));
	pausebg->setPosition(ccpp(-0.49, 0.42));
	pausetxt->setPosition(
			ccp(pausebg->getContentSize().width / 2,
					pausebg->getContentSize().height / 2));
	pausetxt->setAnchorPoint(ccp(0.5, 0.5));
	pausebg->addChild(pausetxt);
	layer->addChild(pausebg);
	return layer;
}
开发者ID:beforeeight,项目名称:sort,代码行数:17,代码来源:GameScene.cpp


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