本文整理汇总了C++中CCMenuItemImage::getSelectedImage方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItemImage::getSelectedImage方法的具体用法?C++ CCMenuItemImage::getSelectedImage怎么用?C++ CCMenuItemImage::getSelectedImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenuItemImage
的用法示例。
在下文中一共展示了CCMenuItemImage::getSelectedImage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
KDbool SGameLayer::init ( KDvoid )
{
if ( !CCLayer::init ( ) )
{
return KD_FALSE;
}
CCSprite* pSprite = CCSprite::create ( "background.png" );
pSprite->setPosition ( ccpMid ( m_tContentSize ) );
this->addChild ( pSprite );
m_pMapLayer = SMapLayer::create ( );
m_pMapLayer->setDelegate ( this );
m_pMapLayer->loadMapWithLevel ( SLevelManager::sharedLevelManager ( )->getLevel ( ) );
m_pMapLayer->setPosition ( ccp ( 20, -15 ) );
this->addChild ( m_pMapLayer, 1 );
CCSprite* pMenuBg = CCSprite::create ( "menu.png" );
pMenuBg->setPosition ( ccp ( m_tContentSize.cx / 2, m_tContentSize.cy - 15 ) );
this->addChild ( pMenuBg, 5 );
m_pLevelLabel = CCLabelTTF::create ( "Level:0", "Marker Felt.ttf", 32 );
m_pLevelLabel->setPosition ( ccp ( 70, m_tContentSize.cy - 15 ) );
m_pLevelLabel->setScale ( 0.6f );
m_pLevelLabel->setColor ( ccYELLOW );
this->addChild ( m_pLevelLabel, 5, 1 );
this->setLevelCount ( SLevelManager::sharedLevelManager ( )->getCurrentLevel ( ) );
m_pStepLabel = CCLabelTTF::create ( "000", "Marker Felt.ttf", 32 );
m_pStepLabel->setScale ( 0.6f );
m_pStepLabel->setColor ( ccYELLOW );
m_pStepLabel->setPosition ( ccp ( 230, m_tContentSize.cy - 15 ) );
this->addChild ( m_pStepLabel, 5, 1 );
this->setStepCount ( 0 );
CCMenuItemImage* pPrevLevel = CCMenuItemImage::create ( "previous.png", "previous.png", this, menu_selector ( SGameLayer::onPrev ) );
( (CCSprite*) pPrevLevel->getSelectedImage ( ) )->setOpacity ( 128 );
pPrevLevel->setPosition ( ccp ( 0, 0 ) );
CCMenuItemImage* pNextLevel = CCMenuItemImage::create ( "next.png", "next.png", this, menu_selector ( SGameLayer::onNext ) );
( (CCSprite*) pNextLevel->getSelectedImage ( ) )->setOpacity ( 128 );
pNextLevel->setPosition ( ccp ( 40, 0 ) );
CCMenuItemImage* pResetLevel = CCMenuItemImage::create ( "reset.png", "reset.png", this, menu_selector ( SGameLayer::onReset ) );
( (CCSprite*) pResetLevel->getSelectedImage ( ) )->setOpacity ( 128 );
pResetLevel->setPosition ( ccp ( 80, 0 ) );
CCMenu* pMenu = CCMenu::create ( pPrevLevel, pNextLevel, pResetLevel, KD_NULL );
pMenu->setPosition ( ccp ( m_tContentSize.cx - 140, m_tContentSize.cy - 15 ) );
this->addChild ( pMenu, 5, 1 );
return KD_TRUE;
}
示例2: explainFive
void TutorialManager::explainFive()
{
back = CCSprite::create("tutorial/tuto_back.png");
back->setPosition(ccp(target->getContentSize().width*0.5,target->getContentSize().height*0.5));
target->addChild(back,ZORDER_TUTORIAL_BACK);
CCSprite* messageBox = CCSprite::create("tutorial/message_popup_box06.png");
messageBox->setPosition(ccp(480,194));
back->addChild(messageBox);
CCMenuItemImage* tutorialEnd = CCMenuItemImage::create("tutorial/tutorial_end_button.png","tutorial/tutorial_end_button.png",this,
menu_selector(TutorialManager::tutorialEnd));
tutorialEnd->getSelectedImage()->setScale(0.9f,0.9f);
CCMenu* menu = CCMenu::create(tutorialEnd,NULL);
menu->setPosition(ccp(480,85));
back->addChild(menu);
for(int i=0;i<5;i++)
{
touchIcon[i] = CCSprite::create("tutorial/touch_icon.png");
touchIcon[i]->setPosition(ccp(338+100*i,470));
target->addChild(touchIcon[i],ZORDER_TUTORIAL_BACK+2);
}
}
示例3: explainDead
void TutorialManager::explainDead(UserInterface* targetInterface)
{
this->targetInterface = targetInterface;
back = CCSprite::create("tutorial/tuto_back.png");
back->setPosition(ccp(target->getContentSize().width*0.5,target->getContentSize().height*0.5));
target->addChild(back,ZORDER_TUTORIAL_BACK);
CCSprite* messageBox = CCSprite::create("tutorial/message_popup_box07.png");
messageBox->setPosition(ccp(480,330));
back->addChild(messageBox);
CCMenuItemImage* confirm = CCMenuItemImage::create("tutorial/confirm.png","tutorial/confirm.png",this,
menu_selector(TutorialManager::deadExplainEnd));
confirm->getSelectedImage()->setScale(0.9f,0.9f);
CCMenu* menu = CCMenu::create(confirm,NULL);
menu->setPosition(ccp(480,220));
back->addChild(menu);
}
示例4: createMenu
KDvoid SuperMarioClick::createMenu ( KDvoid )
{
CCMenuItemImage* pReset = CCMenuItemImage::create ( "Reset.png", "Reset.png", this, menu_selector ( SuperMarioClick::resetGame ) );
( (CCSprite*) pReset->getSelectedImage ( ) )->setOpacity ( 200 );
CCMenu* pMenu = CCMenu::createWithItem ( pReset );
pMenu->setPosition ( m_tContentSize.cx - 36 * 3, m_tContentSize.cy - 36 );
this->addChild ( pMenu, -1 );
}
示例5: init
//.........这里部分代码省略.........
#ifndef BODY_DEBUG
this->addChild(pSprite, -20);
#endif
//pChracImg = CCSprite::create("chracter/move_ani.png");
//box2d///
b2Vec2 gravity = b2Vec2(0.0f,-30.0f);
_world = new b2World(gravity);
_world->SetAllowSleeping(true);
_world->SetContinuousPhysics(true);
contactListener = new MyContactListener();
_world->SetContactListener((b2ContactListener*)contactListener);
b2BodyDef groundBodyDef;
groundBodyDef.position.Set(0,0);
b2Body *groundBody = _world->CreateBody(&groundBodyDef);
b2EdgeShape groundEdge;
b2FixtureDef boxShapeDef;
boxShapeDef.shape = &groundEdge;
CCSize s = this->getContentSize();
//////////////////////////////////////// Debug
#ifdef BODY_DEBUG
b2Draw *debugDraw = new GLESDebugDraw(PTM_RATIO); //PTM_RATIO 를 1~3 정도로 작게 두니까 맞던데?
debugDraw->SetFlags(GLESDebugDraw::e_shapeBit);
_world->SetDebugDraw(debugDraw);
#endif
//doSnow();
pressing = false;
//doRain();
////////////////////////pause
pauseButton = Buttons::create();
CCMenuItemImage* pauseImage = CCMenuItemImage::create("UI/pause.png","UI/pause.png",NULL,this,
menu_selector(GameState::pauseGame));
pauseImage->getSelectedImage()->setScale(0.9f,0.9f);
CCSize pauseSize = pauseImage->getContentSize();
pauseButton->addChild(pauseImage);
pauseButton->setPosition(ccp(getContentSize().width-pauseSize.width*0.5,getContentSize().height-pauseSize.height*0.5));
this->addChild(pauseButton,ZORDER_INTERFACE);
//////////////////////////////Stage
stageManager = new StageManager(_world,this);
//////////////Sound
SoundManager::getInstance()->playBackgroundMusic("music/background/game_bgm_loop.ogg",true);
SoundManager::getInstance()->setBackgroundMusicVolume(0.3f);
PauseState::getInstance()->setResumeTarget(this);
EffectManager::getInstance()->setTarget(this);
//fade
fade = CCSprite::create("over/fade.png");
fade->setOpacity(0);
fade->setPosition(ccp(visibleSize.width/2,visibleSize.height/2));
fade->retain();
#if(CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
this->setKeypadEnabled(true); //키패드 활성.
#endif
userInterface = new UserInterface(this);
doRain();
isPressReload = false;
tutorialManager = new TutorialManager(this);
tutorialManager->setCurrentPage(100);
this->schedule(schedule_selector(GameState::update));
this->schedule(schedule_selector(Timer::update));
this->schedule(schedule_selector(GameState::box2DTest));
stageManager->stageUp();
ScoreManager::sharedInstance()->moveDistance = 0;
ScoreManager::sharedInstance()->point = 0;
return true;
}
示例6: selectPillar
void HelloWorld::selectPillar(CCObject* target)
{
bool bTopBlock = true;
float topBlockSize;
float selectedBlockSize;
// set all pillar colors to default
for (int i=0 ; i<3 ; i++)
{
((CCMenuItemImage*)((this->getChildByTag(i))->getChildByTag(i)))->setOpacity(255);
}
// set selected pillar
CCMenuItemImage* pillar = (CCMenuItemImage*)(target);
selectedPillar = pillar->getTag();
//pillar->setOpacity(140);
//CCLog("selectedPillar is %i",selectedPillar);
if (topBlock[selectedPillar] == 20)
{
topBlockSize = 0;
}
else
{
topBlockSize = ((CCMenuItemImage*)(this->getChildByTag(topBlock[selectedPillar])->getChildByTag(topBlock[selectedPillar])))->getScaleX();
}
selectedBlockSize = ((CCMenuItemImage*)(this->getChildByTag(selectedBlock)->getChildByTag(selectedBlock)))->getScaleX();
// if selected block size is < top block on pillar OR no block on pillar OR no block above it, run move block fxn
CCMenuItemImage* block = ((CCMenuItemImage*)(this->getChildByTag(selectedBlock)->getChildByTag(selectedBlock)));
float aboveBlock = block->getPositionY() + bHeight;
for (int x=3 ; x<10 ; x++)
{
if (((CCMenuItemImage*)(this->getChildByTag(x)->getChildByTag(x)))->boundingBox().containsPoint(ccp(block->getPositionX(),aboveBlock)) == true)
{
//CCLog("block exists above selected block");
bTopBlock = false;
break;
}
}
//CCLog("topBlockSize is %f\nselectedBlockSize is %f",topBlockSize,selectedBlockSize);
if ((numBlock[selectedPillar] == 0) || (selectedBlockSize < topBlockSize))
{
if (bTopBlock == true)
moveBlock();
}
// winning condition - 7 blocks,top block is tag 9
for (int y=1 ; y<3 ; y++)
{
if (numBlock[y] == 7)
{
if (topBlock[y] == 9)
{
CCSprite* winMsg = CCSprite::create("/winMsg.png");
winMsg->setPosition(ccp(240,150));
winMsg->setScale(float(.5));
this->addChild(winMsg);
CCMenu* restartM = CCMenu::create();
CCMenuItemImage* restartB = CCMenuItemImage::create("/restartB.png","/restartB.png",this,menu_selector(HelloWorld::restartGame));
(restartB->getSelectedImage())->setScale(.75);
(restartB->getSelectedImage())->setPosition(ccp(restartB->getPositionX()+20,restartB->getPositionY()+20));
restartB->setScale(float(.5));
restartB->setPositionY(-50);
restartM->addChild(restartB);
this->addChild(restartM);
break;
}
}
}
}