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


C++ CCRGBAProtocol类代码示例

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


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

示例1: CCARRAY_FOREACH

void CCControlButton::setOpacity(GLubyte opacity)
{
    m_cOpacity = opacity;

    CCObject* child;
    CCArray* children=getChildren();
    CCARRAY_FOREACH(children, child)
    {
        CCRGBAProtocol* pNode = dynamic_cast<CCRGBAProtocol*>(child);
        if (pNode)
        {
            pNode->setOpacity(opacity);
        }
    }
开发者ID:tungt84,项目名称:cocos2d-blackberry,代码行数:14,代码来源:CCControlButton.cpp

示例2: underAttack

void CArmySprite::underAttack(int nHurt)
{
	if (m_eCurState >= AS_EXPLODE)
	{
		return ;
	}
	m_sCurData.mHealthPoint -= nHurt;
	if (m_bIsNormal)
	{
		m_bIsNormal = false;
		CCRGBAProtocol *pRGBAProtocol = dynamic_cast<CCRGBAProtocol*>(m_pTurretSprite);
		color = pRGBAProtocol->getColor();
		pRGBAProtocol->setColor(ccc3(255,0,0));
	}

	if (m_sCurData.mHealthPoint < 0)
	{
		m_sCurData.mHealthPoint = 0;
		m_eCurState = AS_EXPLODE;
		m_pTurretSprite->setVisible(false);
		m_pBaseSprite->setVisible(false);
		if (m_pCapSprite)
		{
			m_pCapSprite->setVisible(false);
		}
		m_pWreckSprite->setVisible(true);
		CGlobalData::getSingleton()->addScore(m_sCurData.mScoreValue);

		Music::playExplode2Effect();

		CGlobalData::getSingleton()->addDesArmyScore(m_sCurLandData.mKind);
		ASSESS_DATA mData;
		if (CCRANDOM_0_1() > 0.5f)
		{
			mData.mKind = ASK_PERFECT;
		}
		else
		{
			mData.mKind = ASK_DEFAULT;
		}
		mData.mPos = getPosition();
		CAssess *pAssess = CAssess::createAssess(mData);
		getParent()->addChild(pAssess, ASSESS_ZORDER);
		mData.mKind = ASK_ADD100;
		mData.mPos = ccpAdd(mData.mPos, ccp(0, getContentSize().height * 0.5f));
		pAssess = CAssess::createAssess(mData);
		getParent()->addChild(pAssess, ASSESS_ZORDER);
		runEffect();
	}
}
开发者ID:342261733,项目名称:cocos2d-x,代码行数:50,代码来源:ArmySprite.cpp

示例3: CCARRAY_FOREACH

void CCScale9Sprite::setColor(const ccColor3B& color)
{
    _color = color;

    CCObject* child;
    CCArray* children = this->getSubviews();
    CCARRAY_FOREACH(children, child)
    {
        CCRGBAProtocol* pNode = dynamic_cast<CCRGBAProtocol*>(child);
        if (pNode)
        {
            pNode->setColor(color);
        }
    }
开发者ID:jonesgithub,项目名称:CrossApp,代码行数:14,代码来源:CCScale9Sprite.cpp

示例4: setEnableRecursiveCascading

static void setEnableRecursiveCascading(CCNode* node, bool enable)
{
    CCRGBAProtocol* rgba = dynamic_cast<CCRGBAProtocol*>(node);
    if (rgba)
    {
        rgba->setCascadeColorEnabled(enable);
        rgba->setCascadeOpacityEnabled(enable);
    }
    
    CCObject* obj;
    CCArray* children = node->getChildren();
    CCARRAY_FOREACH(children, obj)
    {
        CCNode* child = (CCNode*)obj;
        setEnableRecursiveCascading(child, enable);
    }
开发者ID:0309,项目名称:cocos2d-x,代码行数:16,代码来源:LayerTest.cpp

示例5: initNodes

bool UIWidget::init()
{
    m_children = CCArray::create();
    m_children->retain();
    initNodes();
    m_pRender->retain();
    m_pRender->setZOrder(m_nWidgetZOrder);
    CCRGBAProtocol* renderRGBA = DYNAMIC_CAST_CCRGBAPROTOCOL;
    if (renderRGBA)
    {
        renderRGBA->setCascadeColorEnabled(true);
        renderRGBA->setCascadeOpacityEnabled(true);
    }
    return true;
}
开发者ID:chenxu111,项目名称:Cocos2d-x-For-CocoStudio,代码行数:15,代码来源:UIWidget.cpp

示例6: fadeInRecursively

void CCTreeFadeIn::fadeInRecursively(CCNode* n, float time) {
    CCArray* children = n->getChildren();
    int cc = n->getChildrenCount();
    for(int i = 0; i < cc; i++) {
        CCNode* child = (CCNode*)children->objectAtIndex(i);
		if(!m_excludeList.containsObject(child)) {
			CCRGBAProtocol* p = dynamic_cast<CCRGBAProtocol*>(child);
			if(p) {
				p->setOpacity((GLubyte)(255 * time));
			}
		}
        
        fadeInRecursively(child, time);
    }
}
开发者ID:WilliamRen,项目名称:cocos2dx-better,代码行数:15,代码来源:CCTreeFadeIn.cpp

示例7: CCARRAY_FOREACH

void Crystal820Layer::updateColor(void)
{
	CCLayerColor::updateColor();
	if(m_pChildren && m_pChildren->count() > 0)
	{
        CCObject* child;
        CCARRAY_FOREACH(m_pChildren, child)
        {
            CCNode* pNode = (CCNode*) child;
			CCRGBAProtocol *pRGBAProtocol = dynamic_cast<CCRGBAProtocol*>(pNode);
			if (pRGBAProtocol)
			{
				pRGBAProtocol->setOpacity(m_cOpacity);
			}
		}
开发者ID:chenyufeng,项目名称:QATDemo-chinese,代码行数:15,代码来源:Crystal820Layer.cpp

示例8: setOpacity

/** Override synthesized setOpacity to recurse items */
void CCLayerRGBA::setOpacity(GLubyte opacity)
{
    _displayedOpacity = _realOpacity = opacity;

    if( _cascadeOpacityEnabled )
    {
        GLubyte parentOpacity = 255;
        CCRGBAProtocol *parent = dynamic_cast<CCRGBAProtocol*>(m_pParent);
        if (parent && parent->isCascadeOpacityEnabled())
        {
            parentOpacity = parent->getDisplayedOpacity();
        }
        updateDisplayedOpacity(parentOpacity);
    }
}
开发者ID:BetaS,项目名称:cocos2d-x,代码行数:16,代码来源:CCLayer.cpp

示例9: setIsOpacityModifyRGB

	void CCLabelBMFont::setIsOpacityModifyRGB(bool var)
	{
		m_bIsOpacityModifyRGB = var;
		if (m_pChildren && m_pChildren->count() != 0)
		{
			NSMutableArray<CCNode*>::NSMutableArrayIterator it;
			for(it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
			{
				CCRGBAProtocol *pRGBAProtocol = (*it)->convertToRGBAProtocol();
				if (pRGBAProtocol)
				{
					pRGBAProtocol->setIsOpacityModifyRGB(m_bIsOpacityModifyRGB);
				}
			}
		}
	}
开发者ID:x007th,项目名称:The-Mana-world-cocos2d-x-client,代码行数:16,代码来源:CCLabelBMFont.cpp

示例10: setColor

void CCLayerRGBA::setColor(const ccColor3B& color)
{
    _displayedColor = _realColor = color;

    if (_cascadeColorEnabled)
    {
        ccColor3B parentColor = ccWHITE;
        CCRGBAProtocol* parent = dynamic_cast<CCRGBAProtocol*>(m_pParent);
        if (parent && parent->isCascadeColorEnabled())
        {
            parentColor = parent->getDisplayedColor();
        }

        updateDisplayedColor(parentColor);
    }
}
开发者ID:BetaS,项目名称:cocos2d-x,代码行数:16,代码来源:CCLayer.cpp

示例11: CCARRAY_FOREACH

void CCLayerRGBA::updateDisplayedOpacity(GLubyte parentOpacity)
{
    _displayedOpacity = _realOpacity * parentOpacity/255.0;

    if (_cascadeOpacityEnabled)
    {
        CCObject *obj = NULL;
        CCARRAY_FOREACH(m_pChildren, obj)
        {
            CCRGBAProtocol *item = dynamic_cast<CCRGBAProtocol*>(obj);
            if (item)
            {
                item->updateDisplayedOpacity(_displayedOpacity);
            }
        }
    }
开发者ID:BetaS,项目名称:cocos2d-x,代码行数:16,代码来源:CCLayer.cpp

示例12: CCARRAY_FOREACH

void CCScale9Sprite::setOpacityModifyRGB(bool var)
{
    if (!_scale9Image)
    {
        return;
    }
    _opacityModifyRGB = var;
    CCObject* child;
    CCArray* children = _scale9Image->getChildren();
    CCARRAY_FOREACH(children, child)
    {
        CCRGBAProtocol* pNode = dynamic_cast<CCRGBAProtocol*>(child);
        if (pNode)
        {
            pNode->setOpacityModifyRGB(_opacityModifyRGB);
        }
    }
开发者ID:109383670,项目名称:cocos2d-x,代码行数:17,代码来源:CCScale9Sprite.cpp

示例13: setOpacity

	void CCLabelBMFont::setOpacity(GLubyte var)
	{
		m_cOpacity = var;

		if (m_pChildren && m_pChildren->count() != 0)
		{
			NSMutableArray<CCNode*>::NSMutableArrayIterator it;
			for(it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
			{
				CCRGBAProtocol *pRGBAProtocol = (*it)->convertToRGBAProtocol();
				if (pRGBAProtocol)
				{
                    pRGBAProtocol->setOpacity(m_cOpacity);
				}
			}
		}
	}
开发者ID:x007th,项目名称:The-Mana-world-cocos2d-x-client,代码行数:17,代码来源:CCLabelBMFont.cpp

示例14: initRenderer

bool UIWidget::init()
{
    m_children = CCArray::create();
    m_children->retain();
    initRenderer();
    m_pRenderer->retain();
    m_pRenderer->setZOrder(m_nWidgetZOrder);
    CCRGBAProtocol* renderRGBA = DYNAMIC_CAST_CCRGBAPROTOCOL;
    if (renderRGBA)
    {
        renderRGBA->setCascadeColorEnabled(true);
        renderRGBA->setCascadeOpacityEnabled(true);
    }
    setBright(true);
    ignoreContentAdaptWithSize(true);
    return true;
}
开发者ID:109383670,项目名称:cocos2d-x,代码行数:17,代码来源:UIWidget.cpp

示例15: FadeOutRecursively

//--------------------------------------------------------------------
// 递归渐隐
void FKCW_Action_TreeFadeOut::FadeOutRecursively( CCNode* p_pRoot, float p_fTime )
{
	CCRGBAProtocol* p = dynamic_cast<CCRGBAProtocol*>(p_pRoot);
	if(p)
	{
		p->setOpacity((GLubyte)(255 * (1 - p_fTime)));
	}

	CCArray* children = p_pRoot->getChildren();
	int cc = p_pRoot->getChildrenCount();
	for(int i = 0; i < cc; i++)
	{
		CCNode* child = (CCNode*)children->objectAtIndex(i);
		if(!m_vecExcludeList.containsObject(child)) 
		{
			FadeOutRecursively(child, p_fTime);
		} 
		else if(!m_bIsRecursivelyExclude) 
		{
			FadeOutRecursively(child, p_fTime);
		}
	}

	// 检查UI
	Widget* w = dynamic_cast<Widget*>(p_pRoot);
	if(w) 
	{
		if(w->getVirtualRenderer()) 
		{
			CCRGBAProtocol* p = dynamic_cast<CCRGBAProtocol*>(w->getVirtualRenderer());
			if(p) 
			{
				p->setOpacity((GLubyte)(255 * (1 - p_fTime)));
			}
		}

		CCArray* children = w->getNodes();
		int cc = children->count();
		for(int i = 0; i < cc; i++) 
		{
			CCNode* child = (CCNode*)children->objectAtIndex(i);
			FadeOutRecursively(child, p_fTime);
		}
	}
}
开发者ID:duzhi5368,项目名称:FKCocos2dxWrapper_2.x,代码行数:47,代码来源:FKCW_Action_TreeFadeOut.cpp


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