本文整理汇总了C++中CCMenuItem::setScaleX方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItem::setScaleX方法的具体用法?C++ CCMenuItem::setScaleX怎么用?C++ CCMenuItem::setScaleX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenuItem
的用法示例。
在下文中一共展示了CCMenuItem::setScaleX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool SelectLevelScene::init(){
if(!CCScene::init()){
return false;
}
CCSprite* bg = CCSprite::create(Images::game::game_bg_jpg);
addChild(bg, -1);
bg->setAnchorPoint(ccp(0, 0));
CCMenu* menu = CCMenu::create();
addChild(menu, 1);
menu->setAnchorPoint(ccp(0, 0));
menu->setPosition(ccp(0, 0));
CCMenuItem* backItem = UIUtil::getSingleImageBtn(
Images::common::back);
menu->addChild(backItem);
backItem->setTarget(this, menu_selector(SelectLevelScene::onClickBtn));
backItem->setTag(-1);
backItem->setAnchorPoint(ccp(1, 0));
LayoutUtil::layoutTo(backItem, 0, 1, bg, 0, 1, 4, -4);
_stageImg = CCSprite::create(Images::selectLevel::level1);
_stageClickedImg = CCSprite::create(Images::selectLevel::level1);
_stageClickedImgMask = CCSprite::create(Images::selectLevel::level1);
_stageClickedImgMask->setColor(ccBLACK);
_stageClickedImgMask->setOpacity(80);
_stageClickedImg->addChild(_stageClickedImgMask, 1);
LayoutUtil::layoutToParentCenter(_stageClickedImgMask, _stageClickedImg);
CCMenuItem* stageItem = CCMenuItemSprite::create(_stageImg, _stageClickedImg);
stageItem->setTarget(this, menu_selector(SelectLevelScene::onClickBtn));
stageItem->setScale(1.3);
stageItem->setTag(1);
menu->addChild(stageItem);
LayoutUtil::layoutToParentCenter(stageItem, this);
CCMenuItem* leftArrow = UIUtil::getSingleImageBtn(Images::selectLevel::icon_arrow);
leftArrow->setTarget(this, menu_selector(SelectLevelScene::prev));
menu->addChild(leftArrow);
LayoutUtil::layoutTo(leftArrow, 1, 0.5, stageItem, 0, 0.5, -18);
CCSprite* leftArrowBg = CCSprite::create(Images::selectLevel::icon_arrow);
leftArrowBg->setScale(1.1);
leftArrowBg->setColor(ccBLACK);
addChild(leftArrowBg, 0);
LayoutUtil::layoutToCenter(leftArrowBg, leftArrow);
CCMenuItem* rightArrow = UIUtil::getSingleImageBtn(Images::selectLevel::icon_arrow);
rightArrow->setTarget(this, menu_selector(SelectLevelScene::next));
menu->addChild(rightArrow);
rightArrow->setScaleX(-1);
LayoutUtil::layoutTo(rightArrow, 0, 0.5, stageItem, 1, 0.5, 18);
CCSprite* rightArrowBg = CCSprite::create(Images::selectLevel::icon_arrow);
rightArrowBg->setScaleX(-1.1);
rightArrowBg->setScaleY(1.1);
rightArrowBg->setColor(ccBLACK);
addChild(rightArrowBg, 0);
LayoutUtil::layoutToCenter(rightArrowBg, rightArrow);
_stageIndexText = CCLabelTTF::create("01/11", "arial-bold", 30);
_stageIndexText->setColor(ccBLACK);
addChild(_stageIndexText, 1);
LayoutUtil::layoutTo(_stageIndexText, 0.5, 0, stageItem, 0.5, 1, 0, -20);
CCLabelTTF* title = CCLabelTTF::create("选择难度", "arial-bold", 38);
title->setColor(ccBLACK);
addChild(title, 1);
LayoutUtil::layoutTo(title, 0.5, 0, _stageIndexText, 0.5, 1, 0, 20);
MusicBtn* musicBtn = MusicBtn::create();
addChild(musicBtn, 1);
LayoutUtil::layoutTo(musicBtn, 0, 0, bg, 0, 0, 5, 5);
_curLevel = 0;
AdUtil::showAd();
return true;
}