本文整理汇总了C++中CCMenuItemImage::setNormalImage方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItemImage::setNormalImage方法的具体用法?C++ CCMenuItemImage::setNormalImage怎么用?C++ CCMenuItemImage::setNormalImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenuItemImage
的用法示例。
在下文中一共展示了CCMenuItemImage::setNormalImage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: menuSetCallback
//设置
void SceneAction::menuSetCallback(CCObject* pSender)
{
TopwoAudio *ta = Topwo::getInstance()->getTopwoAudio();
CCMenuItemImage* item = static_cast<CCMenuItemImage*>(pSender);
if (ta->getSoundState(true))
{
item->setNormalImage(CCSprite::create(RES_btn_sound_on_0));
item->setSelectedImage(CCSprite::create(RES_btn_sound_on_1));
}
else
{
item->setNormalImage(CCSprite::create(RES_btn_sound_off_0));
item->setSelectedImage(CCSprite::create(RES_btn_sound_off_1));
}
if (pSender)
{
ta->playEffect(1);
}
}
示例2: CCLOG
void Study1::wordCB(CCObject* pSender)
{
CCMenuItemImage *pi = (CCMenuItemImage*)pSender;
int tag = pi->getTag();
CCLOG("menu item:%d",tag);
CCNode *img = CCSprite::createWithTexture(CCTextureCache::sharedTextureCache()->textureForKey("wkszStudy1/wordbg3.png"));
pi->setNormalImage(img);
if (tag != current_character) {
stopCurrentCharacter();
current_character = tag;
playCurrentCharacter(true);
}
}
示例3: ccp
void Study1::initWords()
{
if (this->strWords.size() == 0) {
return;
}
CCPoint wordPoint[6] = {
ccp(296,110),
ccp(383,110),
ccp(466,110),
ccp(552,110),
ccp(636,110),
ccp(720,110),};
CCMenu* pMenu = CCMenu::create();
pMenu->setPosition( CCPointZero );
addChild(pMenu);
char str[100];
for (int i=0; i<strWords.size(); i++) {
CCMenuItemImage *pi = CCMenuItemImage::create(
"wkszStudy1/wordbg1.png",
"wkszStudy1/wordbg2.png",
this,
menu_selector(Study1::wordCB) );
if (i == 0) {
CCNode *img = CCSprite::createWithTexture(CCTextureCache::sharedTextureCache()->textureForKey("wkszStudy1/wordbg3.png"));
pi->setNormalImage(img);
}
pi->setPosition(wordPoint[i%PAGE_CAPACITY]);
pi->setTag(i);
pi->setVisible(false);
menuWords.push_back(pi);
pMenu->addChild(pi);
CCLOG("str:%s",strWords[i].c_str());
CCLabelTTF* pLabel = CCLabelTTF::create(strWords[i].c_str(), "Thonburi", 34);
pLabel->setPosition( ccp(297+i%PAGE_CAPACITY*85,112) );
pLabel->setColor(ccBLACK);
pLabel->setVisible(false);
labelWords.push_back(pLabel);
this->addChild(pLabel, 9);
sprintf(str, "wkszCharacter1/%s.swf",strWords[i].c_str());
CCSWFNode* swf1 = CCSWFNode::create(str);
swf1->setPosition(ccp(506,445));
// swf1->setScale(0.8f);
// swf1->runAction();
swf1->setRepeat(true);
swf1->setVisible(false);
swfWords1.push_back(swf1);
this->addChild(swf1,9);
sprintf(str, "wkszCharacter2/%s.swf",strWords[i].c_str());
CCSWFNode* swf2 = CCSWFNode::create(str);
swf2->setPosition(ccp(280,243));
// swf2->setScale(0.8f);
// swf2->runAction();
swf2->setRepeat(true);
swf2->setVisible(false);
swfWords2.push_back(swf2);
this->addChild(swf2,9);
}
}