当前位置: 首页>>代码示例>>C++>>正文


C++ CCLayerColor::runAction方法代码示例

本文整理汇总了C++中CCLayerColor::runAction方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLayerColor::runAction方法的具体用法?C++ CCLayerColor::runAction怎么用?C++ CCLayerColor::runAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCLayerColor的用法示例。


在下文中一共展示了CCLayerColor::runAction方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setFadeEffect

void EasyEffect::setFadeEffect(float fTime,fadeTYPE fType)
{
	CCLayerColor* clrLayer	= (CCLayerColor*)CCDirector::sharedDirector()->getRunningScene()->getChildByTag(99);
	if(clrLayer == NULL)
		return;

	switch(fType)
	{
	case white_FADE_IN:
		{
			clrLayer->initWithColor(Color4B(255,255,255,255));
			CCActionInterval* whtFadeOut=CCFadeTo::create(fTime,0);
			clrLayer->runAction(whtFadeOut);
			break;
		}
	case white_FADE_OUT:
		{
			clrLayer->initWithColor(ccc4(255,255,255,0));
			CCActionInterval* whtFadeIn=CCFadeTo::create(fTime,255);
			clrLayer->runAction(whtFadeIn);
			break;
		}
	case black_FADE_IN:
		{
			clrLayer->initWithColor(ccc4(0,0,0,255));
			CCActionInterval* blkFadeOut=CCFadeTo::create(fTime,0);
			clrLayer->runAction(blkFadeOut);
			break;
		}
	case black_FADE_OUT:
		{
			clrLayer->initWithColor(ccc4(0,0,0,0));
			CCActionInterval* blkFadeIn=CCFadeTo::create(fTime,255);
			clrLayer->runAction(blkFadeIn);
			break;
		}
	case black_FADE_HOLD:
		{
			clrLayer->initWithColor(ccc4(0,0,0,255));
		}
		break;
	case black_FADE_OUTIN:
		{
			CCActionInterval* blkFadeOut=CCFadeTo::create(fTime,255);
			CCActionInterval* blkFadeIn=CCFadeTo::create(fTime,0);
			CCActionInterval*	seq	= CCSequence::create(blkFadeOut,blkFadeIn,NULL);
			clrLayer->runAction(seq);
		}
		break;
	}
}
开发者ID:huangshucheng,项目名称:MyUtil,代码行数:51,代码来源:EasyEffect.cpp

示例2: show

void ShowTip::show(const char *str, cocos2d::CCPoint& point, float fontSize, float delayTime, bool displayBg)
{
    CCLabelTTF* ttfTip = CCLabelTTF::create(str, "宋体", fontSize);
    ttfTip->cocos2d::CCNode::setAnchorPoint(CCPoint(0, 0));
    
    CCSize size = ttfTip->getContentSize();
    CCLayerColor* bgColor = NULL;
    if (displayBg)
    {
        bgColor = CCLayerColor::create();
        bgColor->setColor(ccColor3B(ccc3(0, 0, 0)));
        bgColor->setAnchorPoint(CCPoint(0.5,0.5));
        bgColor->setPosition(CCPoint(point.x - size.width * 0.5, point.y - 40));
        bgColor->setContentSize(size);
        bgColor->addChild(ttfTip);
        this->addChild(bgColor);
        
        ttfTip->setFontFillColor(ccColor3B(ccc3(255, 255, 255)));
    }
    else
    {
        size = CCSize(0,0);
        ttfTip->setFontFillColor(ccColor3B(ccc3(0, 0, 0)));
        ttfTip->setPosition(CCPoint(point.x, point.y - 60));
        this->addChild(ttfTip);
    }
    
    
    CCAction*  moveTo  = CCMoveTo::create(delayTime, CCPoint(point.x - size.width * 0.5, point.y + 40));
    
    if ( displayBg && bgColor )
    {
        CCFadeIn* fadeIn  = CCFadeIn::create(delayTime * 0.25);
        CCScaleTo* scaleTo = CCScaleTo::create(delayTime * 0.5, 1);
        CCFadeOut* fadeOut = CCFadeOut::create(delayTime * 0.25);
        bgColor->runAction(CCSequence::create(fadeIn,scaleTo, fadeOut, NULL));
        bgColor->runAction(moveTo);
    }
    else
    {
        CCFadeIn* fadeIn  = CCFadeIn::create(delayTime * 0.5);
        CCFadeOut* fadeOut = CCFadeOut::create(delayTime * 0.5);
        ttfTip->runAction(CCSequence::create(fadeIn, fadeOut, NULL));
        ttfTip->runAction(moveTo);
    }
    
    scheduleOnce(schedule_selector(ShowTip::removeFromParent), delayTime);
}
开发者ID:Fruedy,项目名称:yangsj,代码行数:48,代码来源:ShowTip.cpp

示例3: onEnter

// LayerIgnoreAnchorPointScale
void LayerIgnoreAnchorPointScale::onEnter()
{
    LayerTest::onEnter();
    
    CCSize s = CCDirector::sharedDirector()->getWinSize();

    CCLayerColor *l = CCLayerColor::create(ccc4(255, 0, 0, 255), 200, 200);

    l->setAnchorPoint(ccp(0.5f, 1.0f));
    l->setPosition(ccp( s.width/2, s.height/2));


    CCScaleBy *scale = CCScaleBy::create(2, 2);
    CCScaleBy* back = (CCScaleBy*)scale->reverse();
    CCSequence *seq = CCSequence::create(scale, back, NULL);

    l->runAction(CCRepeatForever::create(seq));

    this->addChild(l, 0, kLayerIgnoreAnchorPoint);

    CCSprite *child = CCSprite::create("Images/grossini.png");
    l->addChild(child);
    CCSize lsize = l->getContentSize();
    child->setPosition(ccp(lsize.width/2, lsize.height/2));

    CCMenuItemFont *item = CCMenuItemFont::create("Toogle ignore anchor point", this, menu_selector(LayerIgnoreAnchorPointScale::onToggle));

    CCMenu *menu = CCMenu::create(item, NULL);
    this->addChild(menu);

    menu->setPosition(ccp(s.width/2, s.height/2));
}
开发者ID:645286681,项目名称:cocos2d-x,代码行数:33,代码来源:LayerTest.cpp

示例4: init

// on "init" you need to initialize your instance
bool TestCleanUp::init()
{
	if ( !CCLayer::init() )
	{
		return false;
	}


	CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
	CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
	float top = origin.y + visibleSize.height;
	CCPoint center = ccp(origin.x + visibleSize.width/2, origin.y + visibleSize.height/2);

	// -----
	// title
	// -------
	CCLabelTTF* title = CCLabelTTF::create();
	title->setString("Test Clean Up");
	title->setPosition(ccp(center.x, top - 50 ));
	addChild(title);

	{
			CCLayerColor* sprite = CCLayerColor::create(ccc4(255,0,0,255));
			sprite->changeWidthAndHeight(100, 100);

			CCMoveBy* move = CCMoveBy::create(100, ccp(0,0));
			sprite->runAction(move);
			// check if has memory leak
	}




	return true;
}
开发者ID:1194451658,项目名称:chromium-bsu-x,代码行数:36,代码来源:TestCleanUp.cpp

示例5: switchMap

//切换游戏地图之前
void GameScene::switchMap()
{
	//创建一个遮罩层,用于地图切换时的显示淡入淡出效果
	CCLayerColor* fadeLayer = CCLayerColor::layerWithColor(ccc4(0, 0, 0, 0));
	fadeLayer->setAnchorPoint(CCPointZero);
	fadeLayer->setPosition(CCPointZero);
	addChild(fadeLayer, kFadeLayer, kFadeLayer);
	//执行淡入动画,结束后调用resetGameLayer方法
	CCAction* action = CCSequence::actions(
		CCFadeIn::actionWithDuration(0.5f),
		CCCallFunc::actionWithTarget(this, callfunc_selector(GameScene::resetGameLayer)),
		NULL);
	fadeLayer->runAction(action);
}
开发者ID:cjl3080434008,项目名称:cocosed-x,代码行数:15,代码来源:GameScene.cpp

示例6: showSlide

void End::showSlide()
{
    CCLayerColor *colorLayer = CCLayerColor::create(ccc4(0, 0, 0, 0));
    addChild(colorLayer,2);

    colorLayer->runAction(CCSequence::create
                          (
                              CCFadeIn::create(0.6),
                              CCCallFunc::create(this, callfunc_selector(End::loadSlide)),
                              CCFadeOut::create(0.6),
                              CCHide::create(),
                              CCCallFunc::create(this, callfunc_selector(End::showSlideText)),
                              NULL
                          ));
}
开发者ID:rickytan,项目名称:Escape,代码行数:15,代码来源:End.cpp

示例7: LichKingBigAttack

void ASBotFightLayer::LichKingBigAttack(){
    
    CCLayerColor* layer = CCLayerColor::create(ccc4(255,255,255,255));
    addChild(layer,5);
    CCActionInterval* fadeIn = CCFadeIn::create(0.2);
    CCDelayTime* delay = CCDelayTime::create(1);
    CCActionInterval* fadeOut = CCFadeOut::create(0.5);
    CCCallFunc* minusHP = CCCallFuncN::create(this, callfuncN_selector(ASBotFightLayer::LichKingMinusHP));
    CCSequence* effect2 = CCSequence::create(fadeIn,delay,fadeOut,minusHP,NULL);
    CCDelayTime* delay1 = CCDelayTime::create(1);
    CCCallFunc* remove = CCCallFuncN::create(this, callfuncN_selector(ASBotFightLayer::removeSwordAndCube));
    CCSequence* effect1 = CCSequence::create(delay1,remove,NULL);
    CCActionInterval* effect3 = CCSpawn::create(effect1,effect2,NULL);

    layer->runAction(effect3);
    
    CCActionInterval* shake1 = CCRotateTo::create(0.15, 30);
    CCActionInterval* shake2 = CCRotateTo::create(0.15, 0);
    CCActionInterval* shake3 = CCRotateTo::create(0.15, -30);
    CCActionInterval* shake4 = CCRotateTo::create(0.15, 0);
    CCSequence* seq1 = CCSequence::create(shake1,shake2,shake3,shake4,NULL);
    BotHero->runAction(seq1);
}
开发者ID:nooboracle,项目名称:ForTest,代码行数:23,代码来源:botLichKingCritical.cpp

示例8: gameOver

void GameScene::gameOver()
{
	CCRingSprite* pRing;
	for(std::list<int>::iterator itr = CCRingSprite::s_tags.begin(); itr != CCRingSprite::s_tags.end() ; itr++){
		pRing = (CCRingSprite*)this->getChildByTag(*itr);
		pRing->unscheduleUpdate();
	}

	getChildByTag(kTagBackground)->unscheduleUpdate();

	m_pBattery->stopUserInput();

	CCTintTo* toWhite = CCTintTo::create(2.0f,255,255,255);
	m_pScoreLabel->runAction(toWhite);

	CCLayerColor* gameOverLayer = CCLayerColor::create(ccc4(0,0,0,128),m_winSize.width,m_winSize.height);
	gameOverLayer->setAnchorPoint(CCPointZero);
	gameOverLayer->setPosition(ccp(0,m_winSize.height));
	gameOverLayer->setOpacity(0);
	CCActionInterval* fade = CCFadeIn::create(1.0f);
	CCMoveTo* move = CCMoveTo::create(0.4f,CCPointZero);
	gameOverLayer->runAction(CCEaseSineIn::create(CCSpawn::createWithTwoActions(fade,move)));
	this->addChild(gameOverLayer,kZOrderGameOverLayer,kTagGameOverLayer);

	CCDelayTime* delay = CCDelayTime::create(0.3f);
	CCCallFunc* ad = CCCallFunc::create(this, callfunc_selector( GameScene::callAd) );
	this->runAction(CCSequence::createWithTwoActions(delay,ad));

	saveScore();

	showRetryButtons();

	SimpleAudioEngine::sharedEngine()->playBackgroundMusic("sounds/GameOver.mp3",false);

	m_gameState = kStateGameOver;
}
开发者ID:yoroyorokun,项目名称:SpaceShoot,代码行数:36,代码来源:GameScene.cpp


注:本文中的CCLayerColor::runAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。