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


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

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


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

示例1: addChild

void E002_Base_P420_CompletePopup::setButtions()
{
    CJSprite* reworkBtnN = CJSprite::createWithCommonPath("e002_common_diary_btn_rework_n.png");
    CJSprite* reworkBtnS = CJSprite::createWithCommonPath("e002_common_diary_btn_rework_s.png");

    CCMenuItemSprite*  reworkBtn = CCMenuItemSprite::create(reworkBtnN,
                                                           reworkBtnS,
                                                           this,
                                                            menu_selector(E002_Base_P420_CompletePopup::_onTouchedReworkBtn));
    
    reworkBtn->setPosition(CJPsdParser::getPsdPosition("e002_common_diary_btn_rework_n", m_psdDictionary));
    
    CJSprite* finishBtnN = CJSprite::createWithCommonPath("e002_common_diary_btn_finish_n.png");
    CJSprite* finishBtnS = CJSprite::createWithCommonPath("e002_common_diary_btn_finish_s.png");
    
    CCMenuItemSprite*  finishBtn = CCMenuItemSprite::create(finishBtnN,
                                                          finishBtnS,
                                                          this,
                                                          menu_selector(E002_Base_P420_CompletePopup::_onTouchedFinishBtn));
    
    finishBtn->setPosition(CJPsdParser::getPsdPosition("e002_common_diary_btn_finish_n", m_psdDictionary));
    
    
   

    CCMenu *menu = CCMenu::create(reworkBtn, finishBtn, NULL);

    menu->setPosition(CCPointZero);
    addChild(menu, kDepth1_actors);

}
开发者ID:JeonJonguk,项目名称:e002_c010,代码行数:31,代码来源:E002_Base_P420_CompletePopup.cpp

示例2: init

bool ProceedController::init(){
    if (!CCLayer::init()) {
        return false;
    }
    
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    
    //暂停按钮
    CCMenuItemSprite *pause = this->instanceButton("pause1.png", "pause2.png", menu_selector(ProceedController::gamePauseFunc));
    pause->setScale(1.5f);
    pause->setPosition(ccp(size.width - pause->getContentSize().width,
                           size.height - pause->getContentSize().height));
    
    //跳跃按钮
    CCMenuItemSprite *jump = this->instanceButton("control_btn1.png", "control_btn2.png", menu_selector(ProceedController::gameJumpFunc));
    jump->setScale(1.6f);
    jump->setPosition(ccp(size.width - jump->getContentSize().width - 50, 100));
    
    //fever按钮
    CCMenuItemSprite *fever = this->instanceButton("Fever_1_1.png", "Fever_1_1.png",menu_selector(ProceedController::gameFeverFunc));
    fever->setScale(1.5f);
    fever->setOpacity(0.0f);
    fever->setPosition(ccp(jump->getPosition().x - fever->getContentSize().width * 2.0,
                           jump->getPosition().y));
    
    CCMenu *menu = CCMenu::create(pause,jump,fever,NULL);
    menu->setPosition(0, 0);
    this->addChild(menu,80);
    
    return true;
}
开发者ID:GITHZZ,项目名称:BlackWhiteRush,代码行数:31,代码来源:ProceedController.cpp

示例3: showBuyCoin

void PrepareLayer::showBuyCoin()
{
	CCSize size = ToolsFun::sharedTools()->getSceneSize();
	CCSprite *bkg = CCSprite::create("DayReward/bkg.png");
	this->addChild(bkg,200,12313154);
	bkg->setPosition(ccp(size.width/2,size.height/2));

	CCSprite *tip1 = CCSprite::create("DayReward/50000coin.png");
	bkg->addChild(tip1);
	tip1->setPosition(ccp(bkg->getContentSize().width/2,bkg->getContentSize().height/2-50*gScaleY));

	CCMenu *menu = CCMenu::create();
	bkg->addChild(menu);
	menu->setPosition(CCPointZero);

	CCSprite *closeNml = CCSprite::create("ui/backUI/close0.png");
	CCSprite *closeSel = CCSprite::create("ui/backUI/close0.png");
	closeSel->setColor(ccc3(80,80,80));

	CCMenuItemSprite *itemClose = CCMenuItemSprite::create(closeNml,closeSel,NULL,this,menu_selector(PrepareLayer::showBuyCoinClose));

	itemClose->setPosition(ccp(bkg->getContentSize().width-40*gScaleX ,bkg->getContentSize().height-60*gScaleY));
	menu->addChild(itemClose);

	CCSprite *spNml = CCSprite::create("DayReward/button.png");
	CCSprite *spSel = CCSprite::create("DayReward/button.png");
	spSel->setColor(ccc3(80,80,80));
	CCMenuItemSprite *itemSp = CCMenuItemSprite::create(spNml,spSel,this,menu_selector(PrepareLayer::showBuyCoinSure));
	itemSp->setPosition(ccp(bkg->getContentSize().width/2 ,35*gScaleY));
	menu->addChild(itemSp);
}
开发者ID:xuqin,项目名称:tgp,代码行数:31,代码来源:PrepareLayer.cpp

示例4: initButton

void FairyControlPanel::initButton(){
	controlType = 1;
	panelBack->removeAllChildrenWithCleanup(true);
	CCSize size = panelBack->getContentSize();
	CCSprite* leftNormal = CCSprite::create(uiLeftNormal);
	CCSprite* leftClick = CCSprite::create(uiLeftClick);
	CCSprite* holdNormal = CCSprite::create(uiHoldNormal);
	CCSprite* holdClick = CCSprite::create(uiHoldClick);
	CCSprite* rightNormal = CCSprite::create(uiRightNormal);
	CCSprite* rightClick = CCSprite::create(uiRightClick);
	CCSprite* upNormal = CCSprite::create(uiUpNormal);
	CCSprite* upClick = CCSprite::create(uiUpClick);
	CCMenuItemSprite* leftButton = CCMenuItemSprite::create(leftNormal, leftClick, this, menu_selector(FairyControlPanel::fairyMenuCallback));
	leftButton->setTag(leftDrection);
	CCMenuItemSprite* holdButton = CCMenuItemSprite::create(holdNormal, holdClick, this, menu_selector(FairyControlPanel::fairyMenuCallback));
	holdButton->setTag(holdDrection);
	CCMenuItemSprite* rightButton = CCMenuItemSprite::create(rightNormal, rightClick, this, menu_selector(FairyControlPanel::fairyMenuCallback));
	rightButton->setTag(rightDrection);
	CCMenuItemSprite* upButton = CCMenuItemSprite::create(upNormal, upClick, this, menu_selector(FairyControlPanel::fairyMenuCallback));
	upButton->setTag(upDrection);
	CCMenu* menu = CCMenu::create(leftButton, holdButton, rightButton, upButton, NULL);
	leftButton->setPosition(ccp(size.width / 5, size.height / 2 + 30));
	upButton->setPosition(ccp(2 * size.width / 5, size.height / 2+ 30));
	holdButton->setPosition(ccp(3 * size.width / 5, size.height / 2 + 30));
	rightButton->setPosition(ccp(4 * size.width / 5, size.height / 2 + 30));
	panelBack->addChild(menu);
	menu->setPosition(ccp(0, - 30));
}
开发者ID:fairysmile,项目名称:cocos2d-x,代码行数:28,代码来源:FairyControlPanel.cpp

示例5: init

bool CStoreLayer::init()
{
	if ( !CCLayer::init() )
		return false;

	CCLayerColor*	player = CCLayerColor::create(ccc4( 0, 0, 0, 50));
	this->addChild(player);

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

	CCTextureCache::sharedTextureCache()->addImage(CONS_DefaultStoreBackGround);

 	CCSprite* pSprite = CCSprite::create( CONS_DefaultStoreBackGround );
 	pSprite->setPosition( ccp( size.width/2, size.height/2 ) );
 	this->addChild( pSprite );

	CCSize sPSize = this->getContentSize();

	CCSprite * ci1 = CCSprite::createWithSpriteFrameName(CONS_Image_Menu_Cancel);
	CCSprite * ci12 = CCSprite::createWithSpriteFrameName(CONS_Image_Menu_Cancel_2);

	CCMenuItemSprite* pCancel = CCMenuItemSprite::create(ci1,ci12,NULL,this,
		menu_selector(CStoreLayer::CanleCallback));
	pCancel->setPosition( ccp(size.width*0.9,size.height*0.1) ); 
	pCancel->setTag( CANLETAG );

	CCSprite* ci3 = CCSprite::create( "Image/Menu_new/TowRMB.png" );
	CCSprite* ci4 = CCSprite::create( "Image/Menu_new/FourRMB.png" );
	CCSprite* ci5 = CCSprite::create( "Image/Menu_new/SixRMB.png" );

	CCMenuItemSprite* pTow = CCMenuItemSprite::create(ci3,ci3,NULL,this,
		menu_selector(CStoreLayer::CanleCallback));
	pTow->setPosition( ccp(sPSize.width / 2, sPSize.height * 0.7 ) ); 
	pTow->setTag( TOWRMBTAG );

	CCMenuItemSprite* pFour = CCMenuItemSprite::create(ci4,ci4,NULL,this,
		menu_selector(CStoreLayer::CanleCallback));
	pFour->setPosition( ccp(sPSize.width/ 2, sPSize.height * 0.5 ) ); 
	pFour->setTag( FOURRMBTAG );

	CCMenuItemSprite* pSix = CCMenuItemSprite::create(ci5,ci5,NULL,this,
		menu_selector(CStoreLayer::CanleCallback));
	pSix->setPosition( ccp(sPSize.width / 2, sPSize.height * 0.3) ); 
	pSix->setTag( SIXRMBTAG );

	CCMenu* pMenu = CCMenu::create( pCancel, pTow, pFour, pSix, NULL );
	pMenu->setPosition(CCPointZero);
	this->addChild(pMenu, 999);		

	this->setTouchEnabled( true );

	AppDelegate::cur_scene_flag = shop_layer;
	AppDelegate::g_pLayer = this;

	return true;
}
开发者ID:chosener,项目名称:HappyMaJiang,代码行数:56,代码来源:StoreLayer.cpp

示例6: MainMenu

bool Scene1Welcome::init(){
	
	if(!CCScene::init()){
		return false;
	}
	
	CCSize size = CCDirector::sharedDirector()->getWinSize();
	
	CCSprite* pBg = CCSprite::create("[email protected]");
	pBg->setPosition(ccp(size.width/2, size.height/2));
	
	CCLayer* layerBtns = CCLayer::create();
	
	this->addChild(pBg);
	this->addChild(layerBtns);
	
	CCSprite* pLogo = CCSprite::create("logo.png");
	pLogo->setAnchorPoint(ccp(0.5, 1));
	pLogo->setPosition(ccp(size.width/2, size.height-150));
	layerBtns->addChild(pLogo);
	
	
	CCSprite* spriteBtnPlay = CCSprite::create("btn_play.png");
	CCSprite* spriteBtnPlaySelected = CCSprite::create("btn_play_selected.png");
	CCMenuItemSprite* menuBtnPlay = CCMenuItemSprite::create(spriteBtnPlay,
															 spriteBtnPlaySelected,
															 this,
															 menu_selector(Scene1Welcome::onBtnPlayClick));
	menuBtnPlay->setPosition(ccp(0.5, 1));
	menuBtnPlay->setPosition(ccp(size.width/2, size.height-420));
	//CCLog("%f", size.height);
	
	MainMenu* mainMenu = new MainMenu();
	
	//layerBtns->addChild(pBtnPlay);
	//layerBtns->addChild(spriteBtnMain);
	
	
	CCMenu* pMenu = CCMenu::create(menuBtnPlay, NULL);
	pMenu->setPosition(CCPointZero);
	layerBtns->addChild(pMenu);
	//layerBtns->addChild(mainMenu->pMenu);
	//mainMenu->showWithAnimate();
	
	//CCActionInterval* actionInterval = CCActionInterval::create(5);
	//CCEaseBackInOut* easeBackInOut = CCEaseBackInOut::create(actionInterval);
	
	//pLogo->runAction(easeBackInOut);
	
	return true;
}
开发者ID:peichao01,项目名称:test,代码行数:51,代码来源:Scene1Welcome.cpp

示例7: __initMainMenu

void HomeScene::__initMainMenu()
{
    CCMenuItemSprite *classic = BaseMenuItemSprite::create(SPRITE("[email protected]"),SPRITE("[email protected]"),this,menu_selector(HomeScene::__gotoClassic));
    CCMenuItemSprite *icebreak = BaseMenuItemSprite::create(SPRITE("[email protected]"),SPRITE("[email protected]"),this,menu_selector(HomeScene::__gotoIcebreak));
    CCMenuItemSprite *pandora = BaseMenuItemSprite::create(SPRITE("[email protected]"),SPRITE("[email protected]"),this,menu_selector(HomeScene::__gotoPandora));
    CCMenuItemSprite *setting = BaseMenuItemSprite::create(SPRITE("[email protected]"),SPRITE("[email protected]"),this,menu_selector(HomeScene::__gotoSettingScene));
	CCMenuItemSprite *rank = BaseMenuItemSprite::create(SPRITE("[email protected]"),SPRITE("[email protected]"),this,NULL);
	CCMenu *mainMenu = CCMenu::create(classic,setting,NULL);
    addChild(mainMenu);
	rank->setPosition(ccp(-130,-365));
	setting->setPosition(ccp(-250,-365));
	classic->setPosition(ccp(0,130));
	pandora->setPosition(ccp(0,-130));
}
开发者ID:AIRIA,项目名称:Brizzle,代码行数:14,代码来源:HomeScene.cpp

示例8: createListView

void NewsScene::createListView()
{
//    CCSize size = CCSize(750, 400);
    CCSize size = CCDirector::sharedDirector()->getWinSize();
  
    CCLayerColor * fundo =  CCLayerColor::create(ccc4(255, 255, 255, 255), size.width, size.height);
    fundo->setAnchorPoint(ccp(0,0));
    fundo->setPosition(ccp(0, 0));
    this->addChild(fundo,10);
//    CCLayerColor * header =  CCLayerColor::create(ccc4(200, 200, 200, 255), size.width, 80);
//    header->setAnchorPoint(ccp(0,0));
//    header->setPosition(ccp(0, size.height -80));
//    fundo->addChild(header);
    
    CCSprite *sprHeader;
    sprHeader = CCSprite::create("Header_Blue.png");
    
    sprHeader->setAnchorPoint(ccp(0,0));
    sprHeader->setScale(1);
    sprHeader->setPosition(ccp(0, size.height -90));
    this->addChild(sprHeader,100);
    CCSprite *sprTitle;
    sprTitle = CCSprite::create("tit_informacoes.png");
    
    sprTitle->setAnchorPoint(ccp(0,0));
    sprTitle->setScale(1);
    sprTitle->setPosition(ccp(110, size.height -50));
    this->addChild(sprTitle,101);
    
    CCMenu* menu = CCMenu::create();
    
    CCSprite *spriteDefault = CCSprite::create("Seta1.png");
    CCSprite *spriteSelected = CCSprite::create("Seta2.png");
    CCMenuItemSprite *item = CCMenuItemSprite::create(spriteDefault, spriteSelected, this,  menu_selector(NewsScene::btnBack));
    item->setAnchorPoint(ccp(0, 0));
    item->setPosition(ccp(0, size.height -90));
    menu->addChild(item, 0, 100);
    menu->setPosition(ccp(10,30));
    menu->setAnchorPoint(ccp(0,0));
    this->addChild(menu,102);
    
    list = CCListView::create(CCListViewModeVertical);
    list = cocos2d::extension::CCListView::create(CCListViewModeVertical);
    list->setDelegate(this);
    list->setContentSize(CCSize(size.width, size.height-70));
    list->setAnchorPoint(ccp(0,0));
    list->setPosition(ccp(0, 0));
    list->setColor(ccc3(50, 50, 50));
    list->setSeparatorStyle(CCListViewCellSeparatorStyleNone);
    
    fundo->addChild(list);
    this->loading = new AnimatedSprite("loader_einstein1.png");
	this->loading->addAnimation(AnimatedSprite::animationWithFile("loader_einstein", 24, 0.030f), "anim");//frame_count
    
    this->addChild(this->loading,999);
    this->loading->runAnimation("anim",true, true);
	this->loading->setAnchorPoint(ccp(0.5f, 0.5f));
	this->loading->setPosition(ccp(CCDirector::sharedDirector()->getWinSize().width/2, CCDirector::sharedDirector()->getWinSize().height/2 - 30));
    this->loading->setVisible(true);
}
开发者ID:rossimrc,项目名称:AlbertEinstein,代码行数:60,代码来源:NewsScene.cpp

示例9: buildGrid

void SlidingMenuGrid::buildGrid(int cols, int rows)
{
	CCSize winSize = CCDirector::sharedDirector()->getWinSize();
    
	int col = 0, row = 0;
	CCArray* child = pMenu->getChildren();
	CCObject* item;
	CCPoint position=getPosition();
	iPageCount=0;
	CCARRAY_FOREACH(child, item)
	{
		CCMenuItemSprite* getItem = (CCMenuItemSprite*) item;
		getItem->setPosition(ccp(position.x +  menuOrigin.x + col * padding.x + (iPageCount * winSize.width), position.y +(winSize.height-menuOrigin.y)- row * padding.y));
		++col;
		if (col == cols)
		{
			col = 0;
			++row;
			if( row == rows )
			{
				iPageCount++;
				col = 0;
				row = 0;
			}
		}
        
	}
开发者ID:BellyWong,项目名称:KrealX,代码行数:27,代码来源:SlidingMenu.cpp

示例10: BasicUIDraw

void RankScene::BasicUIDraw(){
    
    //1.背景
    CCSprite* bg = CCSprite::createWithSpriteFrameName("bg_l.png");
    bg->setPosition(ccp(winSize.width/2, winSize.height/2));
    addChild(bg,0);
    
    //2.翻转层
    layerToRoll = CCLayer::create();
    addChild(layerToRoll,1);
    
    //3.金币部分
    CCSprite* heartTable = CCSprite::createWithSpriteFrameName("HeartTable.png");
    heartTable->setScaleX(0.5);
    heartTable->setScaleY(0.417);
    heartTable->setPosition(ccp(size.width*7.75/30,size.height*2100/2200+winDif*4*(2-alpha)));
    addChild(heartTable,9999);
    
    CCSprite* goldTable = CCSprite::createWithSpriteFrameName("GoldTable.png");
    goldTable->setScale(0.417);
    goldTable->setPosition(ccp(size.width*21.75/30,size.height*2100/2200+winDif*4*(2-alpha)));
    addChild(goldTable,9999);
    
    CCLabelTTF* goldNumber = CCLabelTTF::create(int2string(MainUser->gold).c_str(), "Arial Rounded MT bold",28,CCSizeMake(size.width/3, 0),kCCTextAlignmentRight);
    goldNumber->setPosition(ccp(size.width*45.5/70, size.height*2100/2200+winDif*4*(2-alpha)));
    addChild(goldNumber,10000,8);
    
    CCSprite* buyGoldButtonSprite = CCSprite::createWithSpriteFrameName("buyGoldButton.png");
    CCSprite* buyGoldButtonSprite_s = CCSprite::createWithSpriteFrameName("buyGoldButton-s.png");
    CCMenuItemSprite* buyGoldButton = CCMenuItemSprite::create(buyGoldButtonSprite,buyGoldButtonSprite_s,this,menu_selector(RankScene::showShopLayer));
    buyGoldButton->setPosition(ccp(size.width*60/70,size.height*2100/2200+winDif*4*(2-alpha)));
    CCMenu* buyGoldMenu = CCMenu::create(buyGoldButton,NULL);
    buyGoldMenu->setPosition(CCPointZero);
    addChild(buyGoldMenu,10000,17);
}
开发者ID:nooboracle,项目名称:ForTest,代码行数:35,代码来源:RankMainScene.cpp

示例11: touchPauseCallBack

void GameScene::touchPauseCallBack(CCObject* obj) {
    if (isGameOver) {
        return;
    }
    
    CCDirector::sharedDirector()->pause();
    
    NoTouchLayer* n = NoTouchLayer::create();
    addChild(n, 10, TAG_NO_LAYER);
    
    CCSprite* mask = CCSprite::createWithSpriteFrameName("mask.png");
    mask->setPosition(ccp(screenSize.width * 0.5f, screenSize.height * 0.5f));
    mask->setScaleX(screenSize.width / mask->getContentSize().width * 1.5f);
    mask->setScaleY(screenSize.height / mask->getContentSize().height * 1.5f);
    addChild(mask, 10, TAG_MASK);
    
    CCSprite* pause = CCSprite::createWithSpriteFrameName("pause.png");
    pause->setPosition(ccp(screenSize.width * 0.5f, screenSize.height * 0.68f));
    pause->setScale(1.5f);
    addChild(pause, 10, TAG_TITLE);
    
    CCMenuItemSprite* item = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("resume.png"), NULL, this, menu_selector(GameScene::pauseResume));
    item->setPosition(ccp(screenSize.width * 0.5f, screenSize.height * 0.3f));
    CCMenu* menu = CCMenu::create(item, NULL);
    menu->setPosition(CCPointZero);
    menu->setTouchPriority(-200000);
    addChild(menu, 10, TAG_RESUME);
}
开发者ID:eclipsezym,项目名称:Cocos2d-x_studying,代码行数:28,代码来源:GameScene.cpp

示例12: init

bool testEffect::init(){
    if ( !CCLayer::init() ){return false;}
    
    CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("0.GeneralPart.plist");
    CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("MikuFight.plist");
    CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("SheldonFight.plist");
    CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("IronManFight.plist");
    CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("LichKingFight.plist");
    CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("BladeMasterFight.plist");
    CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("FightGeneral.plist");
    
    ASBotFightLayer* aaa = ASBotFightLayer::createAsFightLayer(2, 4,true,1000,1,10000,6,10000,10);
    aaa->setPosition(CCPointZero);
    addChild(aaa,9999,9999);
    
    CCMenu* menu = CCMenu::create();
    for (int i = 1; i < 7 ; i++) {
        string tmp = "card_" + int2string(i) + ".png";
        CCSprite* repeatSprite = CCSprite::createWithSpriteFrameName(tmp.c_str());
        CCMenuItemSprite* repeat = CCMenuItemSprite::create(repeatSprite,repeatSprite,this,menu_selector(testEffect::Repeat));
        repeat->setScale(0.45);
        repeat->setPosition(ccp(size.width/7 + size.width*(i-1)/7,size.height/8));
        repeat->setTag(i);
        menu->addChild(repeat);
    }
    menu->setPosition(CCPointZero);
    addChild(menu,10000);

    return true;
}
开发者ID:nooboracle,项目名称:ForTest,代码行数:30,代码来源:testEffect.cpp

示例13: init

bool GameReviveLayer::init()
{
	if(!CCLayer::init())
		return false;

	CCSize size = ToolsFun::sharedTools()->getSceneSize();
	CCSprite *bkgSprite = CCSprite::create("DayReward/bkg.png");
	this->addChild(bkgSprite, 3);
	bkgSprite->setPosition(size / 2);

	CCMenu *menu = CCMenu::create();
	menu->setPosition(CCPointZero);
	bkgSprite->addChild(menu, 1);

	CCSprite *closeNor = CCSprite::create("ui/shared/closeTipNml.png");
	CCSprite *closeSel = CCSprite::create("ui/shared/closeTipNml.png");
	closeSel->setColor(ccc3(80, 80, 80));
	CCMenuItemSprite *closeItem = CCMenuItemSprite::create(closeNor, closeSel, this, menu_selector(GameReviveLayer::close));
	closeItem->setPosition(ccp(bkgSprite->getContentSize().width * 5 / 6, bkgSprite->getContentSize().height * 6 / 7));
	menu->addChild(closeItem, 144);

	CCSprite *getNor = CCSprite::create("ui/shared/continueGame.png");
	CCSprite *getSel = CCSprite::create("ui/shared/continueGame.png");
	getSel->setColor(ccc3(80, 80, 80));
	CCMenuItemSprite *getItem = CCMenuItemSprite::create(getNor, getSel, this, menu_selector(GameReviveLayer::purchase));
	getItem->setPosition(ccp(bkgSprite->getContentSize().width / 2, 10*gScaleY));
	menu->addChild(getItem, 144);
	

	CCSprite *tip1 = CCSprite::create("DayReward/advanced.png");
	bkgSprite->addChild(tip1);
	tip1->setPosition(ccp(bkgSprite->getContentSize().width/2,bkgSprite->getContentSize().height/2-50*gScaleY));

	/*
	char buf[32];
	sprintf(buf,"%d",6);
	CCLabelTTF *label = CCLabelTTF::create(buf,"΢ÈíÑźÚ",38);
	getItem->addChild(label);
	label->setScale(0.6f);
	label->setColor(ccc3(220 ,220 ,220));
	label->setPosition(ccp(bkgSprite->getPositionX()/2,bkgSprite->getPositionY()/2 ));*/

	registerNDK();

	return true;
}
开发者ID:xuqin,项目名称:tgp,代码行数:46,代码来源:GameReviveLayer.cpp

示例14: addElements

void StatusUpgrade::addElements(std::string name, CCPoint position){
    CCLabelTTF* strength = CCLabelTTF::create(name.c_str(), "Thonburi", 10);
    strength->setAnchorPoint(ccp(0,0.5));
    strength->setPosition(ccp(30, position.y));
    strength->setColor(ccc3(0,0,0));
    this->addChild(strength, 1);
    
    CCLabelTTF* currentLabel = CCLabelTTF::create(CCString::createWithFormat("%d", this->_current)->getCString(), "arial", 10);
    currentLabel->setAnchorPoint(ccp(0,0.5));
    currentLabel->setPosition(ccp(90, position.y));
    currentLabel->setColor(ccc3(0,0,0));
    this->addChild(currentLabel);
    
    char* desc = this->getDescription(name);
    CCLabelTTF* description = CCLabelTTF::create(desc, "Thonburi", 8);
    description->setAnchorPoint(ccp(0,0.5));
    description->setPosition(ccp(35, position.y - 20));
    description->setColor(ccc3(0,0,0));
    this->addChild(description);
    
    afterLabel   = CCLabelTTF::create(CCString::createWithFormat("-> %d", this->_current + this->_currentAddition)->getCString(), "arial", 10);
    afterLabel->setAnchorPoint(ccp(0, 0.5));
    afterLabel->setPosition(ccp(120, position.y));
    afterLabel->setColor(ccc3(0,0,0));
    this->addChild(afterLabel);
    
    CCSprite* plus = CCSprite::createWithSpriteFrameName("plus.png");
    CCSprite* plusOff = CCSprite::createWithSpriteFrameName("plus.png");
    plusOff->setColor(ccc3(102,102,102));
    CCMenuItemSprite* pPlusButton =
        CCMenuItemSprite::create(plus, plusOff, this, menu_selector(StatusUpgrade::plus));
    
    CCSprite* minus = CCSprite::createWithSpriteFrameName("minus.png");
    CCSprite* minusOff = CCSprite::createWithSpriteFrameName("minus.png");
    minusOff->setColor(ccc3(102,102,102));
    CCMenuItemSprite* pMinusButton =
        CCMenuItemSprite::create(minus, minusOff, this, menu_selector(StatusUpgrade::minus));
    
    pPlusButton->setPosition(ccp(position.x - 90, position.y));
    pMinusButton->setPosition(ccp(position.x - 50, position.y));
    CCMenu* pMenu = CCMenu::create(pPlusButton, pMinusButton, NULL);
 //   pMenu->setTouchPriority(kLevelUpLayerMenuPriority);
    pMenu->setPosition(CCPointZero);
    
    this->addChild(pMenu);
}
开发者ID:sukesan1984,项目名称:diabloraid,代码行数:46,代码来源:StatusUpgrade.cpp

示例15: initShareMessageBox

void AsMessageBox::initShareMessageBox(int subType){
    
    if(!MainUser->muted)
        CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("openFrame.wav");
    
    shareImageIndex = subType;
    
    //1.截屏
    if (subType == 1) {
        CCRenderTexture* pScreen = CCRenderTexture::create(winSize.width,winSize.height);
        CCScene* pCurScene = CCDirector::sharedDirector()->getRunningScene();
        pScreen->begin();
        pCurScene->visit();
        pScreen->end();
        pScreen->saveToFile("shared.png",kCCImageFormatPNG);
    }

    //2.黑色底层
    cover = CCLayerColor::create(ccc4(0,0,0,200));
    cover->setPosition(CCPointZero);
    addChild(cover,0);
    
    //3.提示框底层
    showbox = CCSprite::createWithSpriteFrameName("shareFrame.png");
    showbox->setScaleY(1.1);
    showbox->setPosition(ccp(size.width/2,size.height/2+winDif*2*alpha));
    cover->addChild(showbox,1);
    
    //4.提示框上的文字
    CCSprite* shareWeixinSprite = CCSprite::createWithSpriteFrameName("shareWeixin.png");
    CCSprite* shareWeixinSprite_s = CCSprite::createWithSpriteFrameName("shareWeixin-s.png");
    CCSprite* shareWeixin1Sprite = CCSprite::createWithSpriteFrameName("shareWeixin1.png");
    CCSprite* shareWeixin1Sprite_s = CCSprite::createWithSpriteFrameName("shareWeixin1-s.png");
    CCSprite* closeSprite = CCSprite::createWithSpriteFrameName("closeMatchTable.png");
    CCSprite* closeSprite_s = CCSprite::createWithSpriteFrameName("closeMatchTable-s.png");
    CCMenuItemSprite* closeItem = CCMenuItemSprite::create(closeSprite,closeSprite_s,this,menu_selector(AsMessageBox::closeMessageBox));
    CCMenuItemSprite* item1 = CCMenuItemSprite::create(shareWeixinSprite,shareWeixinSprite_s,this,menu_selector(AsMessageBox::goShare));
    CCMenuItemSprite* item2 = CCMenuItemSprite::create(shareWeixin1Sprite,shareWeixin1Sprite_s,this,menu_selector(AsMessageBox::goShare));
    item1->setTag(10);
    item2->setTag(11);
    item1->setPosition(ccp(size.width*18/50,size.height*10/20+winDif*2.18*alpha));
    item2->setPosition(ccp(size.width*32/50,size.height*10/20+winDif*2.18*alpha));
    closeItem->setPosition(ccp(size.width*5.7/7,size.height*11.5/20+winDif*2.18*alpha));
    closeMenu = CCMenu::create(item1,item2,closeItem,NULL);
    closeMenu->setPosition(CCPointZero);
    addChild(closeMenu,2);
    
    //5.文字提示
    CCLabelTTF* shareToIndiLabel = CCLabelTTF::create("分享给朋友","Arial Rounded MT Bold",24);
    CCLabelTTF* shareToCircleLabel = CCLabelTTF::create("分享到朋友圈","Arial Rounded MT Bold",24);
    shareToIndiLabel->setColor(ccc3(55, 55, 55));
    shareToCircleLabel->setColor(ccc3(55, 55, 55));
    shareToIndiLabel->setPosition(ccp(size.width*18/50,size.height*8/20+winDif*2.18*alpha));
    shareToCircleLabel->setPosition(ccp(size.width*32/50,size.height*8/20+winDif*2.18*alpha));
    addChild(shareToIndiLabel,7,53);
    addChild(shareToCircleLabel,7,54);
    
}
开发者ID:nooboracle,项目名称:ForTest,代码行数:58,代码来源:Type3Share.cpp


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