本文整理汇总了C++中CCMenuItemLabel::getLabel方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItemLabel::getLabel方法的具体用法?C++ CCMenuItemLabel::getLabel怎么用?C++ CCMenuItemLabel::getLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenuItemLabel
的用法示例。
在下文中一共展示了CCMenuItemLabel::getLabel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: musicButtonTapped
void Options::musicButtonTapped(CCObject*object)
{
SimpleAudioEngine::sharedEngine()->playEffect("Select.wav", false);
CCMenuItemLabel *SoundFX = (CCMenuItemLabel*)object;
CCLabelTTF *label = (CCLabelTTF *)SoundFX->getLabel();
if(SaveLoad::m_SaveData.musicVolume <= 0.0f)
{
SaveLoad::m_SaveData.musicVolume = 1.0f;
label->setString("Music: ON");
AudioManager::g_MasterMusicAudio = 1.0f;
}
else
{
SaveLoad::m_SaveData.musicVolume = 0.0f;
label->setString("Music: OFF");
AudioManager::g_MasterMusicAudio = 0.0f;
}
AudioManager::AudioOn();
SaveLoad::Save();
}
示例2: eventMenuCallback
void AccountLayer::eventMenuCallback(CCObject* pSender) {
CCMenuItemLabel* pMenuItem = (CCMenuItemLabel*)pSender;
char buf[64];
int i = pMenuItem->getTag();
CCLog("DeviceId:%s", TDCCTalkingDataGA::getDeviceId());
sprintf(buf, s_EventMenuItem[i].id.c_str(), ++_indexes[i]);
CCLabelTTF* label = (CCLabelTTF*)pMenuItem->getLabel();
label->setString(buf);
switch (i) {
case CREATE_USER_ID:
mTDGAaccount = TDCCAccount::setAccount(label->getString());
break;
case ADD_LEVEL:
if (mTDGAaccount) mTDGAaccount->setLevel(_indexes[i]);
break;
case UPDATE_GAME_SERVER:
if (mTDGAaccount) mTDGAaccount->setGameServer(label->getString());
break;
case UPDATE_USER_NAME:
if (mTDGAaccount) mTDGAaccount->setAccountName(label->getString());
break;
case UPDATE_GENDER:
if (mTDGAaccount) mTDGAaccount->setGender(mTDGAaccount->kGenderMale);
break;
case UPDATE_TYPE:
if (mTDGAaccount) mTDGAaccount->setAccountType(mTDGAaccount->kAccountType1);
break;
default:
break;
}
}
示例3: menuItemCallback
void TestAircraft::menuItemCallback(CCObject* menuItem)
{
CCMenuItemLabel* menuItemLabel = dynamic_cast<CCMenuItemLabel*>(menuItem);
CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
if(menuItemLabel)
{
CCLabelTTF* label = dynamic_cast<CCLabelTTF*>(menuItemLabel->getLabel());
if(!label)
return;
string labelString = label->getString();
if(labelString == "straight")
{
// straight
{
Aircraft* enemy = Aircraft::createEnemyStraight();
addChild(enemy);
enemy->setPosition(screenSize.width/2, screenSize.height/2 + 150);
}
}
else if(labelString == "omni")
{
// enemy omni
{
Aircraft* omni = Aircraft::createEnemyOmni();
addChild(omni);
omni->setPosition(screenSize.width/2, screenSize.height/2 + 150);
}
}
else if(labelString == "ray gun")
{
// ray gun
{
Aircraft* enemy = Aircraft::createEnemyRayGun();
addChild(enemy);
enemy->setPosition(screenSize.width/2, screenSize.height/2 + 150);
}
}
else if(labelString == "tank")
{
// tank
{
Aircraft* enemy = Aircraft::createEnemyTank();
addChild(enemy);
enemy->setPosition(screenSize.width/2, screenSize.height/2 + 150);
}
}
else if(labelString == "boss00")
{
// enemy boss
Aircraft* boss = Aircraft::createBoss00();
addChild(boss);
boss->setPosition(screenSize.width/2, screenSize.height/2 + 150);
}
else if(labelString == "boss01")
{
// boss 01
{
Aircraft* enemy = Aircraft::createBoss01();
addChild(enemy);
enemy->setPosition(screenSize.width/2, screenSize.height/2 + 150);
}
}
else if(labelString == "hero")
{
Aircraft* hero = Aircraft::createHeroAircraft();
addChild(hero);
hero->setPosition(screenSize.width/2, screenSize.height/2);
GameController::sharedInstance()->setPlayerAircraft(hero);
}
}
}