本文整理汇总了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);
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
}
}
示例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;
}
示例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);
}
}
}