本文整理汇总了C++中CCMenuItemLabel::getPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItemLabel::getPosition方法的具体用法?C++ CCMenuItemLabel::getPosition怎么用?C++ CCMenuItemLabel::getPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenuItemLabel
的用法示例。
在下文中一共展示了CCMenuItemLabel::getPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool Options::init()
{
if (!CCLayer::init()) {
return false;
}
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCSprite *sp = CCSprite::create(s_loading);
sp->setAnchorPoint(CCPointZero);
addChild(sp, 0, 1);
CCTexture2D *imageCache = CCTextureCache::sharedTextureCache()->addImage(s_menuTitle);
CCSprite *title = CCSprite::createWithTexture(imageCache, CCRectMake(0, 0, 134, 34));
title->setPosition(ccp(winSize.width/2, winSize.height - 60));
addChild(title);
CCMenuItemFont *menuTitle = CCMenuItemFont::create("Sound");
menuTitle->setFontName("Arial");
menuTitle->setFontSize(18);
menuTitle->setEnabled(false);
CCMenuItemFont::setFontName("Arial");
CCMenuItemFont::setFontSize(26);
CCMenuItemToggle *toggle = CCMenuItemToggle::createWithTarget(this, menu_selector(Options::setOptions), CCMenuItemFont::create("On"),CCMenuItemFont::create("Off"), NULL);
int selectId = Config::sharedConfig()->getAudioState()? 0 : 1;
toggle->setSelectedIndex(selectId);
CCLabelBMFont *backLb = CCLabelBMFont::create("Go Back", s_font);
CCMenuItemLabel *goBack = CCMenuItemLabel::create(backLb, this, menu_selector(Options::goBack));
goBack->setScale(0.6);
CCActionInterval *fadeIn = CCFadeTo::create(1, 80);
CCActionInterval *fadeOut = CCFadeTo::create(1, 255);
CCEaseSineInOut *ease1 = CCEaseSineInOut::create(fadeIn);
CCEaseSineInOut *ease2 = CCEaseSineInOut::create(fadeOut);
CCFiniteTimeAction *seq = CCSequence::create(ease1, ease2, NULL);
// 这里也是,参数必须强转,否则NDK编译不过
goBack->runAction(CCRepeatForever::create((CCActionInterval*)seq));
CCMenu *menu = CCMenu::create( menuTitle, toggle, goBack, NULL);
menu->alignItemsInColumns(2,1);
addChild(menu);
CCPoint pos = goBack->getPosition();
pos.y -= 50;
goBack->setPosition(pos);
return true;
}