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


C++ MenuItemSprite类代码示例

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


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

示例1: new

MenuItemSprite * MenuItemSprite::create(Node *normalSprite, Node *selectedSprite, Node *disabledSprite, const ccMenuCallback& callback)
{
    MenuItemSprite *ret = new (std::nothrow) MenuItemSprite();
    ret->initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, callback);
    ret->autorelease();
    return ret;
}
开发者ID:Ratel13,项目名称:WarriorQuest,代码行数:7,代码来源:CCMenuItem.cpp

示例2: init

bool BowManHightScore::init()
{
	if(!Layer::init()){
		return false;
	}


	Size visibleSize = Director::getInstance()->getVisibleSize();

	Sprite* backSprite1 = Sprite::create("img/button/back_btn.png");
	Sprite* backSprite2 = Sprite::create("img/button/back_btn1.png");


	MenuItemSprite* backBtn = MenuItemSprite::create(
		backSprite1 , 
		backSprite2 ,
		CC_CALLBACK_1(BowManHightScore::backCallback , this)
		);

	backBtn->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
	backBtn->setPosition(Vec2(
		10 + backBtn->getContentSize().width/2 ,
		visibleSize.height - 10 - backBtn->getContentSize().height/2
		));

	Menu* menu = Menu::create(
		backBtn,
		NULL
		);

	this->addChild(menu);

	return true;
}
开发者ID:vienbk91,项目名称:parkour,代码行数:34,代码来源:BowManHightScore.cpp

示例3: MenuItemSprite

// XXX deprecated
MenuItemSprite * MenuItemSprite::create(Node *normalSprite, Node *selectedSprite, Node *disabledSprite, Object *target, SEL_MenuHandler selector)
{
    MenuItemSprite *pRet = new MenuItemSprite();
    pRet->initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, target, selector); 
    pRet->autorelease();
    return pRet;
}
开发者ID:bassarisse,项目名称:LostInCaves,代码行数:8,代码来源:CCMenuItem.cpp

示例4: CC_CALLBACK_1

void UI::ShowGameOver( cocos2d::Layer *layer )
{
    Size screenSize = Director::getInstance( )->getVisibleSize( );

    Sprite *background = Sprite::create( GAME_OVER_BACKGROUND );
    background->setPosition( SonarCocosHelper::UI::GetScreenCenter( ) );
    background->setOpacity( 0 );
    layer->addChild( background );
    background->runAction( Sequence::create( DelayTime::create( PIECE_FADE_IN_TIME * 2.5 ), FadeIn::create( GAME_OVER_BACKGROUND_FADE_IN_TIME ), NULL ) );
    
    MenuItemImage *overlayWindowItem = MenuItemImage::create( GAME_OVER_WINDOW, GAME_OVER_WINDOW, GAME_OVER_WINDOW, NULL );
    MenuItemSprite *retryItem = MenuItemSprite::create( Sprite::create( RETRY_BUTTON ), Sprite::create( RETRY_BUTTON_PRESSED ), Sprite::create( RETRY_BUTTON ), CC_CALLBACK_1( UI::Retry, this ) );
    retryItem->setPosition( Vec2( overlayWindowItem->getContentSize( ).width / 4, retryItem->getPositionY( ) ) );
    MenuItemSprite *mainMenuItem = MenuItemSprite::create( Sprite::create( HOME_BUTTON ), Sprite::create( HOME_BUTTON_PRESSED ), Sprite::create( HOME_BUTTON_PRESSED ), CC_CALLBACK_1( UI::GoToMainMenu, this ) );
    mainMenuItem->setPosition( Vec2( -overlayWindowItem->getContentSize( ).width / 4, mainMenuItem->getPositionY( ) ) );
    
    
    Menu *menu = Menu::create( overlayWindowItem, retryItem, mainMenuItem, NULL );
    menu->setPosition( Vec2( SonarCocosHelper::UI::GetScreenCenter( ).x, SonarCocosHelper::UI::GetScreenCenter( ).y + screenSize.height ) );
    layer->addChild( menu );
    

    EaseBounceOut *menuActionEasing = EaseBounceOut::create( MoveTo::create( MENU_MOVE_BOUNCE_DURATION, SonarCocosHelper::UI::GetScreenCenter( ) ) );
    Sequence *menuShowSeq = Sequence::create( DelayTime::create( PIECE_FADE_IN_TIME * 2.5 ), menuActionEasing, NULL );
    menu->runAction( menuShowSeq );
}
开发者ID:SonarSystems,项目名称:Tic-Tac-Toe-Cocos2d-x,代码行数:26,代码来源:UI.cpp

示例5: addChild

void HelloWorld::showResult() {

    Size visibleSize = Director::getInstance()->getVisibleSize();

    //add black cover
    blackLayer = LayerColor::create(Color4B(0, 0, 0, 120));
    blackLayer->setContentSize(visibleSize);
    blackLayer->setPosition(0,0);
    addChild(blackLayer);


    cool = Label::createWithSystemFont("COOL!", "Hobo std", 90);
    cool->setPosition(visibleSize.width/2, visibleSize.height*2/3);
    this->addChild(cool);
    moon->setSpriteFrame("MoonCry.png");

    //Play again button
    Sprite* PlayAgainButton = Sprite::createWithSpriteFrameName("ReplayButton.png");
    MenuItemSprite* PlayButtonItem = MenuItemSprite::create(PlayAgainButton, PlayAgainButton,
                                     CC_CALLBACK_1(HelloWorld::playAgainCallBack, this));
    PlayButtonItem->setPosition(Director::getInstance()->convertToGL(Vec2(visibleSize.width/2-100, visibleSize.height*3/4)));


    //add all items into setMenu
    playAgainMenu = Menu::create(PlayButtonItem, NULL);
    playAgainMenu->setPosition(Vec2::ZERO);
    this->addChild(playAgainMenu);


}
开发者ID:jiehu567,项目名称:WormHeroSaga,代码行数:30,代码来源:HelloWorldScene.cpp

示例6: FONTSIZE

bool ResultLayer::init()
{
    if (!Layer::init())
    {
        return false;
    }
    //des
    LabelTTF* labelDes = LabelTTF::create(PlayRound::shared()->getPrivityDescription(PlayRound::shared()->getLevel()), "黑体", FONTSIZE(25));
    //LabelTTF* labelDes = LabelTTF::create(PlayRound::shared()->getPrivityDescription(0), "黑体", 30);
    labelDes->setPosition(Point(COMWinSize().width/2,COMWinSize().height*0.9));
    addChild(labelDes);
    
    __String* strLevel = __String::createWithFormat("我到了第%d层啦!",PlayRound::shared()->getLevel());
    LabelTTF* labelLevel = LabelTTF::create(strLevel->getCString(), "黑体", FONTSIZE(40));
    labelLevel->setPosition(Point(COMWinSize().width/2,COMWinSize().height*0.8));
    addChild(labelLevel);

    Sprite* spNormal = Sprite::create("image/btn_restart.png");
    Sprite* spSelect = Sprite::create("image/btn_restart.png");
//    spNormal->setScale(960/COMWinSize().height);
//    spSelect->setScale(960/COMWinSize().height);
    spSelect->setColor(Color3B(200,200,200));
    
    MenuItemSprite* itemSp = MenuItemSprite::create(spNormal, spSelect, CC_CALLBACK_1(ResultLayer::onClick, this));
    //MenuItemLabel* label = MenuItemLabel::create(LabelTTF::create("重新开始", "黑体", 50),CC_CALLBACK_1(ResultLayer::onClick, this) );
    itemSp->setTag(kResultRestartTag);
    Menu* menu = Menu::create(itemSp, nullptr);
    menu->setPosition(Point(COMWinSize().width/2,COMWinSize().height/2));
    this->addChild(menu);
    if (CCRANDOM_0_1()>0.8)
    {
        ShowYouAd::shared()->showYouWallSpot();
    }
    //Results.m4a
    CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("Sound/Results.m4a");
    //历史分数
    __String* strHistory;

    int iHistory = UserDefault::getInstance()->getIntegerForKey("HistoryScore");
    if (iHistory<PlayRound::shared()->getLevel()) {
        iHistory = PlayRound::shared()->getLevel();
        UserDefault::getInstance()->setIntegerForKey("HistoryScore", PlayRound::shared()->getLevel());
        UserDefault::getInstance()->flush();
        strHistory = __String::createWithFormat("打破记录啦:%d层!!!",iHistory);

    }
    else
    {
        strHistory = __String::createWithFormat("历史最高:%d层",iHistory);
    }
    LabelTTF* ttfHistory = LabelTTF::create(strHistory->getCString(), "黑体", FONTSIZE(50));
    ttfHistory->setPosition(Point(COMWinSize().width/2,COMWinSize().height*0.7));
    addChild(ttfHistory);
    return true;
}
开发者ID:yitianljt,项目名称:word,代码行数:55,代码来源:ResultLayer.cpp

示例7: menuSelect

void TeachingLayer::menuSelect(Ref* pSender)
{
	MenuItemSprite* pItem = dynamic_cast<MenuItemSprite*>(pSender);
	curPage = pItem->getTag();
	for (int i = 0;i<4;i++)
	{
		dynamic_cast<MenuItemSprite*>(pItem->getParent()->getChildByTag(i))->unselected();
	}
	pItem->selected();
	pageView->scrollToPage(curPage);
}
开发者ID:qq125384977,项目名称:TowerDefenseGame,代码行数:11,代码来源:TeachingLayer.cpp

示例8: init

bool BowManInforGame::init()
{
    if(!Layer::init())
    {
        return false;
    }

    /////////////////////////////////////////////////////////////////
    // BACKGROUNG INFO
    /////////////////////////////////////////////////////////////////

    Sprite* background = Sprite::create("img/background/bg_info.png");
    background->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
    background->setPosition(Vec2(WINSIZE.width/2 , WINSIZE.height/2));
    this->addChild(background);


    /////////////////////////////////////////////////////////////////
    // DIALOG INFO
    /////////////////////////////////////////////////////////////////

    Sprite* infoDialog = Sprite::create("img/dialog/info_dialog.png");
    infoDialog->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
    infoDialog->setPosition(Vec2(WINSIZE.width/2 , WINSIZE.height/2));
    this->addChild(infoDialog);



    /////////////////////////////////////////////////////////////////
    // BACK BUTTON
    /////////////////////////////////////////////////////////////////

    Sprite* backSprite1 = Sprite::create("img/button/back_btn.png");
    Sprite* backSprite2 = Sprite::create("img/button/back_btn1.png");

    MenuItemSprite* backBtn = MenuItemSprite::create(
                                  backSprite1,
                                  backSprite2,
                                  CC_CALLBACK_1(BowManInforGame::backCallback, this)
                              );

    backBtn->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
    backBtn->setPosition(Vec2(
                             10 + backBtn->getContentSize().width / 2,
                             WINSIZE.height - 10 - backBtn->getContentSize().height / 2
                         ));

    Menu* menu = Menu::create(backBtn,NULL);

    this->addChild(menu);

    return true;
}
开发者ID:vienbk91,项目名称:parkour,代码行数:53,代码来源:BowManInforGame.cpp

示例9: createMenuItem

MenuItemSprite* CardLevelUpLayer::createMenuItem(std::string spritename, std::string textname)
{
	auto normal = Sprite::createWithSpriteFrameName(spritename + "0.png");
	auto select = Sprite::createWithSpriteFrameName(spritename + "1.png");
	auto disable = Sprite::createWithSpriteFrameName(spritename + "2.png");

	auto text = Sprite::createWithSpriteFrameName(textname);
	text->setPosition(normal->getContentSize().width / 2, normal->getContentSize().height / 2);
	MenuItemSprite* menuItem = MenuItemSprite::create(normal, select, disable);
	menuItem->addChild(text);

	return menuItem;
}
开发者ID:Youjk,项目名称:CardGame,代码行数:13,代码来源:CardLevelUpLayer.cpp

示例10: log

// on "init" you need to initialize your instance
bool MusicLayer_2::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }
    
    log("MusicLayer_2 init");
    
    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();
    
    Sprite *bg = Sprite::create("background.png");
    
    // position the label on the center of the screen
    bg->setPosition(Vec2(origin.x + visibleSize.width/2,
                         origin.y + visibleSize.height /2));
    this->addChild(bg);
    
    //开始精灵
    Sprite *startSpriteNormal = Sprite::create("start-up.png");
    Sprite *startSpriteSelected = Sprite::create("start-down.png");
    
    MenuItemSprite *startMenuItem = MenuItemSprite::create(startSpriteNormal,
                                                           startSpriteSelected,
                                                           CC_CALLBACK_1(MusicLayer_2::menuItemStartCallback, this));
    startMenuItem->setPosition(Director::getInstance()->convertToGL(Vec2(700, 170)));
    
    // 设置图片菜单
    MenuItemImage *settingMenuItem = MenuItemImage::create(
                                                           "setting-up.png",
                                                           "setting-down.png",
                                                           CC_CALLBACK_1(MusicLayer_2::menuItemSettingCallback, this));
    settingMenuItem->setPosition(Director::getInstance()->convertToGL(Vec2(480, 400)));
    
    // 帮助图片菜单
    MenuItemImage *helpMenuItem = MenuItemImage::create(
                                                        "help-up.png",
                                                        "help-down.png",
                                                        CC_CALLBACK_1(MusicLayer_2::menuItemHelpCallback, this));
    helpMenuItem->setPosition(Director::getInstance()->convertToGL(Vec2(860, 480)));
    
    Menu* mu = Menu::create(startMenuItem, settingMenuItem, helpMenuItem, NULL);
    mu->setPosition(Vec2::ZERO);
    this->addChild(mu);
    
    return true;
}
开发者ID:wingsmm,项目名称:LearningCocos,代码行数:51,代码来源:MusicScene_2.cpp

示例11: Face

void ConfirmLayer::createLayersContent() {
    GameModel* gameModel = GameModel::getInstance();
    
    Face* backgroundFade = new Face();
    backgroundFade->initWithFile(ANI_BACKGROUND_FADE);
    backgroundFade->setPosition(Point(gameModel->getDisplayResolutionSize().width / 2, gameModel->getDisplayResolutionSize().height / 2));
    backgroundFade->setOpacity(0);
    this->mainLayer->addChild(backgroundFade);
    this->backgroundFade = backgroundFade;
    {
        FiniteTimeAction* fadeIn = FadeIn::create(0.5f);
        backgroundFade->registerState(STATE_FADE_IN, fadeIn);
        
        FiniteTimeAction* fadeOut = FadeOut::create(0.5f);
        backgroundFade->registerState(STATE_FADE_OUT, fadeOut);
    }
    
    Face* menuFace = new Face();
    menuFace->initWithSpriteFrameName(ANI_BOX_CONFIRM);
    menuFace->setPosition(Point(gameModel->getDisplayResolutionSize().width / 2, -500));
    this->mainLayer->addChild(menuFace);
    this->menuFace = menuFace;
    Size menuFaceSize = menuFace->getContentSize();
    
    UGMenu* optionMenu = UGMenu::create();
    optionMenu->setPosition(Point::ZERO);
    menuFace->addChild(optionMenu);
    {
        Label* confirmLabel = Label::createWithBMFont(FONT_GAME_SMALL, TXT_CONFIRM_TEXT);
        confirmLabel->setPosition(menuFaceSize.width / 2, menuFaceSize.height / 2);
        this->menuFace->addChild(confirmLabel);
    }
    {
        FiniteTimeAction* move1 = MoveTo::create(0, menuFace->getPosition());
        FiniteTimeAction* move2 = MoveTo::create(0.5f, Point(gameModel->getDisplayResolutionSize().width / 2, gameModel->getDisplayResolutionSize().height / 2));
        FiniteTimeAction* move3 = CallFunc::create(CC_CALLBACK_0(ConfirmLayer::onOptionBoardMoveUpDone, this));
        FiniteTimeAction* move123 = Sequence::create(move1, move2, move3, NULL);
        menuFace->registerState(STATE_MOVE_UP, move123);
        
        FiniteTimeAction* move4 = MoveTo::create(0, Point(gameModel->getDisplayResolutionSize().width / 2, gameModel->getDisplayResolutionSize().height / 2));
        FiniteTimeAction* move5 = MoveTo::create(0.5f, menuFace->getPosition());
        FiniteTimeAction* move6 = CallFunc::create(CC_CALLBACK_0(ConfirmLayer::onOptionBoardMoveDownDone, this));
        FiniteTimeAction* move456 = Sequence::create(move4, move5, move6, NULL);
        menuFace->registerState(STATE_MOVE_DOWN, move456);
        
        MenuItemSprite* okButton = Utils::createButton((char*) TXT_OK, 16, ANI_BUTTON_SMALL, ANI_BUTTON_SMALL);
        okButton->setCallback(CC_CALLBACK_1(ConfirmLayer::onOkButtonClick, this));
        okButton->setPosition(Point(menuFaceSize.width / 2 - 129, 0));
        okButton->setEnabled(false);
        optionMenu->addChild(okButton);
        this->okButton = okButton;
        
        MenuItemSprite* cancelButton = Utils::createButton((char*) TXT_CANCEL, 16, ANI_BUTTON_SMALL, ANI_BUTTON_SMALL);
        cancelButton->setCallback(CC_CALLBACK_1(ConfirmLayer::onCancelButtonClick, this));
        cancelButton->setPosition(Point(menuFaceSize.width / 2 + 129, 0));
        cancelButton->setEnabled(false);
        optionMenu->addChild(cancelButton);
        this->cancelButton = cancelButton;
    }
}
开发者ID:vuadoc,项目名称:BigHero,代码行数:60,代码来源:ConfirmLayer.cpp

示例12: if

void LayerGameMain::updateBigBoomCount(int bigBoomCount)
{
	String strBoomCount;
	Sprite * norBoom = Sprite::createWithSpriteFrameName("bomb.png");
	Sprite * selBoom = Sprite::createWithSpriteFrameName("bomb.png");
	if (bigBoomCount < 0)
	{
		return;
	}
	else if (bigBoomCount == 0)
	{
		if (this->getChildByTag(TAG_BIGBOOM))
		{
			this->removeChildByTag(TAG_BIGBOOM,true);
		}
		if (this->getChildByTag(TAG_BIGBOOMCOUNT))
		{
			this->removeChildByTag(TAG_BIGBOOMCOUNT,true);
		}
	}
	else if (bigBoomCount == 1)
	{
		if ( !(this->getChildByTag(TAG_BIGBOOM)) )
		{
			MenuItemSprite * boomItem = MenuItemSprite::create(norBoom,
															   selBoom,
															   CC_CALLBACK_1(LayerGameMain::boomMenuCallback,this));
			boomItem->setPosition(norBoom->getContentSize().width/2,norBoom->getContentSize().height/2);
			Menu * boomMenu = Menu::create(boomItem,nullptr);
			boomMenu->setPosition(Point::ZERO);
			this->addChild(boomMenu,0,TAG_BIGBOOM);
		}
		if ( !(this->getChildByTag(TAG_BIGBOOMCOUNT)) )
		{
			strBoomCount.initWithFormat("X %d",bigBoomCount);
			LabelBMFont * labelBoomCount = LabelBMFont::create(strBoomCount.getCString(),"font/font.fnt");
			labelBoomCount->setAnchorPoint(Point::ANCHOR_MIDDLE_LEFT);
			labelBoomCount->setPosition(Point(norBoom->getContentSize().width,norBoom->getContentSize().height - 30));
			this->addChild(labelBoomCount,0,TAG_BIGBOOMCOUNT);
		}
	}
	else if (bigBoomCount > 1 && bigBoomCount < MAX_BIGBOOM_COUNT)
	{
		strBoomCount.initWithFormat("X %d",bigBoomCount);
		LabelBMFont * labelCount = (LabelBMFont *)this->getChildByTag(TAG_BIGBOOMCOUNT);
		labelCount->setString(strBoomCount.getCString());
	}
}
开发者ID:DreamZL,项目名称:PlaneFight,代码行数:48,代码来源:LayerGameMain.cpp

示例13: setScale

// on "init" you need to initialize your instance
bool MainMenu::init()
{
  if ( !Layer::init() )
  {
    return false;
  }
  
  Sprite* background = Sprite::create("mainbg.jpg");
  background->setPosition(SCREEN_SIZE.width/2, SCREEN_SIZE.height/2);
  setScale(SCREEN_SIZE.width/background->getContentSize().width,
           SCREEN_SIZE.height/background->getContentSize().height);
  
  addChild(background);
  
  Sprite* normalS = Sprite::create("startButton.png");
  Sprite* selectedS = Sprite::create("startButton.png");
  selectedS->setColor(Color3B::GRAY);
  MenuItemSprite* start = MenuItemSprite::create(normalS,
                                                selectedS,
                                                CC_CALLBACK_1(MainMenu::goToStartScene, this));
  Point posStart = Point(SCREEN_SIZE.width/2, SCREEN_SIZE.height/4 + 10);
  start->setPosition(posStart);
  start->setScale(0.5f);
  
  Sprite* normalE = Sprite::create("emergencyButton.png");
  normalE->setColor(Color3B::RED);
  Sprite* selectedE = Sprite::create("emergencyButton.png");
  selectedE->setColor(Color3B::GRAY);
  MenuItemSprite* emergency = MenuItemSprite::create(normalE,
                                                     selectedE,
                                                     CC_CALLBACK_1(MainMenu::goToStartScene, this));
  Point posEmer = Point(SCREEN_SIZE.width/3 + 10, SCREEN_SIZE.height/4 + 10);
  emergency->setPosition(posEmer);
  emergency->setScale(0.5f);
  
  Sprite* normalSe = Sprite::create("settingButton.png");
  Sprite* selectedSe = Sprite::create("settingButton.png");
  selectedSe->setColor(Color3B::GRAY);
  MenuItemSprite* settings = MenuItemSprite::create(normalSe,
                                                    selectedSe,
                                                    CC_CALLBACK_1(MainMenu::goToStartScene, this));
  Point posSe = Point(2 * SCREEN_SIZE.width/3 - 10, SCREEN_SIZE.height/4 + 10);
  settings->setPosition(posSe);
  settings->setScale(0.5f);


  Menu* menu = Menu::create(start, emergency, settings, NULL);
  menu->setPosition(Point::ZERO);
  
  addChild(menu, 1);
  
  return true;
}
开发者ID:K57CA-PMP,项目名称:SaveTheWorld,代码行数:54,代码来源:MainMenu.cpp

示例14: addLayer

//pageview的用法
void TeachingLayer::addLayer(int index)
{
	auto winSize = Director::getInstance()->getWinSize();
	pageView = PageView::create();
	//一定要设置大小,不然看不见
	pageView->setContentSize(winSize);
	pageView->setBackGroundColor(Color3B::GREEN);
	pageView->setBackGroundColorType(Layout::BackGroundColorType::SOLID);
	pageView->removeAllPages();
	pageView->setPosition(Vec2::ZERO);
	if (index == 0)
	{
		for (int i=0;i<4;++i)
		{
			//pageview一定要配合layout使用
			Layout* layout = Layout::create();
			layout->setContentSize(winSize);
			auto layer = TeachingSubLayer::create(index,i);
			//layer->setPosition(Vec2(winSize.width/2,winSize.height/2));
			layout->addChild(layer);
			//----按钮
			MenuItemSprite* pJumpItem;
			if (i<=2)
			{
				auto nextNormal = Sprite::create("teaching_next.png");
				auto nextPressed = Sprite::create("teaching_next.png");
				nextPressed->setScale(1.4f);
				pJumpItem = MenuItemSprite::create(nextNormal,nextPressed,CC_CALLBACK_0(TeachingLayer::menuJump,this));
				//pJumpItem->setPosition(Vec2(winSize.width/2 - 60,35-winSize.height/2));
				pJumpItem->setPosition(Vec2(winSize.width - pJumpItem->getContentSize().width,
					pJumpItem->getContentSize().height));
			}
			else//最后一步
			{
				auto nextNormal = Sprite::create("teaching_enter.png");
				auto nextPressed = Sprite::create("teaching_enter.png");
				nextPressed->setScale(1.4f);
				pJumpItem = MenuItemSprite::create(nextNormal,nextPressed,CC_CALLBACK_0(TeachingLayer::menuJump,this));
				pJumpItem->setPosition(Vec2(winSize.width - pJumpItem->getContentSize().width,
					pJumpItem->getContentSize().height));
			}
			pJumpItem->setAnchorPoint(Vec2::ANCHOR_BOTTOM_RIGHT);

			auto pMenu = Menu::create(pJumpItem,nullptr);
			pMenu->setPosition(Vec2::ZERO);
			layer->addChild(pMenu,3);

			pageView->insertPage(layout,i);
		}
	}

	curPage = 0;
	pageView->scrollToPage(curPage);
	pageView->addEventListener(CC_CALLBACK_2(TeachingLayer::pageViewEvent, this));

	this->addChild(pageView);
}
开发者ID:qq125384977,项目名称:TowerDefenseGame,代码行数:58,代码来源:TeachingLayer.cpp

示例15: createButtonFontSmall

MenuItemSprite* CNodeUtil::createButtonFontSmall(const string& text, int fontSize, string normalFrameName, string selectedFrameName) {
    Sprite* normalSprite = Sprite::createWithSpriteFrameName(normalFrameName);
    Sprite* selectedSprite = Sprite::createWithSpriteFrameName(selectedFrameName);
    normalSprite->getTexture()->setAliasTexParameters();
    selectedSprite->getTexture()->setAliasTexParameters();
    
    MenuItemSprite* button = MenuItemSprite::create(normalSprite, selectedSprite);
    
    Label* normalText = CNodeUtil::createLabelTTF(text, fontSize, FONT_ARCADE);
    normalText->setPosition(Point(button->getContentSize().width / 2, button->getContentSize().height / 2));
    normalText->enableShadow();
    normalSprite->addChild(normalText);
    Label* selectedText = CNodeUtil::createLabelTTF(text, fontSize, FONT_ARCADE);
    selectedText->setPosition(Point(button->getContentSize().width / 2, button->getContentSize().height / 2));
    selectedText->enableShadow();
    selectedSprite->addChild(selectedText);
    
    return button;
}
开发者ID:chung1991,项目名称:mf2507,代码行数:19,代码来源:CNodeUtil.cpp


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