本文整理汇总了C++中CCLayerColor::visit方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLayerColor::visit方法的具体用法?C++ CCLayerColor::visit怎么用?C++ CCLayerColor::visit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCLayerColor
的用法示例。
在下文中一共展示了CCLayerColor::visit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadResAndInit
void AdventureLevelClass::loadResAndInit()
{
CCSize size = LcdAdapClass::sharedLCDADAP()->getWinSize();
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("Themes/scene/stages_bg-hd.plist");
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("Themes/scene/themescene1-hd.plist");
memset(comBuffer, 0, sizeof(comBuffer));
sprintf(comBuffer, "Themes/scene/stages_theme%d-hd.plist",GameStageConClass::sharedStageCon()->getGameStageIndex());
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(comBuffer);
bgSprite = CCSprite::createWithSpriteFrameName("ss_bg.png");
CCSize bgSize = bgSprite->getContentSize();
// bgSprite->setPosition(ccp(size.width / 2, size.height / 2));
LcdAdapClass::sharedLCDADAP()->setAdaptorNodePos(bgSprite, ccp(size.width / 2, size.height / 2));
this->addChild(bgSprite,1);
CCSprite* bgCN = CCSprite::createWithSpriteFrameName("ss_bg_CN.png");
bgCN->setPosition(ccp(bgSize.width/2, bgSize.height/2));
bgSprite->addChild(bgCN,1);
if (GameStageConClass::sharedStageCon()->getGameStageIndex() != GAME_STAGE_TYPE_EXTRE) {
memset(comBuffer, 0, sizeof(comBuffer));
sprintf(comBuffer, "ss_towers_%02d.png",(curPageIndex + 1));
levelTowerTypeSP = CCSprite::createWithSpriteFrameName(comBuffer);//default
levelTowerTypeSP->setPosition(ccp(bgSize.width/2, bgSize.height * 18/100));
bgSprite->addChild(levelTowerTypeSP,3);
levelNumSP = CCSprite::createWithSpriteFrameName("ss_waves_10.png");//default
levelNumSP->setPosition(ccp(bgSize.width/2, bgSize.height * 84/100));
bgSprite->addChild(levelNumSP,3);
CCSprite* leftCloud = CCSprite::createWithSpriteFrameName("ss_cloud.png");
CCSize cloudSize = leftCloud->getContentSize();
leftCloud->setPosition(ccp(bgSize.width / 2, bgSize.height / 2));
bgSprite->addChild(leftCloud,5);
}
ccColor4B color;
color.a = 125;
color.b = 0;
color.g = 0;
color.r = 0;
scrollLayer = CCLayer::create();//default pos is (0,0)
scrollLayer->setContentSize(CCSize(size.width * levelNum / 2, size.height));
bgSprite->addChild(scrollLayer,15);
for (int i = 0; i < levelNum; i++) {
gameLevelInfoStruct levelInfo = HUDClass::sharedHUD()->getGameCurLevelInfo((GAME_STAGE_TYPE)(GameStageConClass::sharedStageCon()->getGameStageIndex()), (i + 1));
memset(comBuffer, 0, sizeof(comBuffer));
sprintf(comBuffer, "ss_map%02d.png",(i + 1));
CCSprite* sprite = CCSprite::createWithSpriteFrameName(comBuffer);
CCSize spriteSize = sprite->getContentSize();
//sprite->setPosition(ccp(size.width / 2, size.height / 2));
memset(comBuffer, 0, sizeof(comBuffer));
sprintf(comBuffer, "%s","gainhonor_1.png");//这里要加个判断,判断用户的荣誉
CCSprite* honorSP = NULL;
if (levelInfo.UserGained > 0 && levelInfo.UserGained < 4) {
sprintf(comBuffer, "gainhonor_%d.png",levelInfo.UserGained);
honorSP = CCSprite::createWithSpriteFrameName(comBuffer);
honorSP->setVisible(true);//要不要显示
}
else
{
honorSP = CCSprite::createWithSpriteFrameName(comBuffer);
honorSP->setVisible(false);//要不要显示
}
honorSP->setPosition(ccp(spriteSize.width * 84/100, spriteSize.height * 22/100));
sprite->addChild(honorSP,1);
CCSprite* allClearSP = CCSprite::createWithSpriteFrameName("gainhonor_4.png");
if (!levelInfo.isClearAllObject) {
allClearSP->setVisible(false);
}
allClearSP->setPosition(ccp(spriteSize.width * 60/100, spriteSize.height * 22/100));
sprite->addChild(allClearSP,1);
levelNormalArray->addObject(sprite);//normal
CCLayerColor* layer = CCLayerColor::create(color);
layer->setContentSize(spriteSize);
ccBlendFunc blend = {GL_DST_ALPHA, GL_SRC_ALPHA};
layer->setBlendFunc(blend);
CCRenderTexture* rt = CCRenderTexture::create(spriteSize.width, spriteSize.height);
sprite->setPosition(ccp(spriteSize.width/2, spriteSize.height/2));
rt->begin();
sprite->visit();
//.........这里部分代码省略.........