本文整理汇总了C++中CCRGBAProtocol::getColor方法的典型用法代码示例。如果您正苦于以下问题:C++ CCRGBAProtocol::getColor方法的具体用法?C++ CCRGBAProtocol::getColor怎么用?C++ CCRGBAProtocol::getColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCRGBAProtocol
的用法示例。
在下文中一共展示了CCRGBAProtocol::getColor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
const ccColor3B& UIWidget::getColor()
{
CCRGBAProtocol* rgbap = DYNAMIC_CAST_CCRGBAPROTOCOL;
if (rgbap)
{
return rgbap->getColor();
}
return ccWHITE;
}
示例2: startWithTarget
void CCTintTo::startWithTarget(CCNode *pTarget)
{
CCActionInterval::startWithTarget(pTarget);
CCRGBAProtocol *pRGBAProtocol = dynamic_cast<CCRGBAProtocol*>(m_pTarget);
if (pRGBAProtocol)
{
m_from = pRGBAProtocol->getColor();
}
/*m_from = pTarget->getColor();*/
}
示例3: startWithTarget
void CCTintTo::startWithTarget(CCNode *pTarget)
{
CCActionInterval::startWithTarget(pTarget);
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
if (pRGBAProtocol)
{
m_from = pRGBAProtocol->getColor();
}
/*m_from = pTarget->getColor();*/
}
示例4: 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();
}
}
示例5: initWithLabelAndBackgroundSprite
bool CCControlButton::initWithLabelAndBackgroundSprite(CCNode* node, CCScale9Sprite* backgroundSprite)
{
if (CCControl::init())
{
CCAssert(node != NULL, "Label must not be nil.");
CCLabelProtocol* label = dynamic_cast<CCLabelProtocol*>(node);
CCRGBAProtocol* rgbaLabel = dynamic_cast<CCRGBAProtocol*>(node);
CCAssert(backgroundSprite != NULL, "Background sprite must not be nil.");
CCAssert(label != NULL || rgbaLabel!=NULL || backgroundSprite != NULL, "");
m_bParentInited = true;
// Initialize the button state tables
this->setTitleDispatchTable(CCDictionary::create());
this->setTitleColorDispatchTable(CCDictionary::create());
this->setTitleLabelDispatchTable(CCDictionary::create());
this->setBackgroundSpriteDispatchTable(CCDictionary::create());
setTouchEnabled(true);
m_isPushed = false;
m_zoomOnTouchDown = true;
m_currentTitle=NULL;
// Adjust the background image by default
setAdjustBackgroundImage(true);
setPreferredSize(CCSizeZero);
// Zooming button by default
m_zoomOnTouchDown = true;
// Set the default anchor point
ignoreAnchorPointForPosition(false);
setAnchorPoint(ccp(0.5f, 0.5f));
// Set the nodes
setTitleLabel(node);
setBackgroundSprite(backgroundSprite);
// Set the default color and opacity
setColor(ccc3(255.0f, 255.0f, 255.0f));
setOpacity(255.0f);
setOpacityModifyRGB(true);
// Initialize the dispatch table
CCString* tempString = CCString::create(label->getString());
//tempString->autorelease();
setTitleForState(tempString, CCControlStateNormal);
setTitleColorForState(rgbaLabel->getColor(), CCControlStateNormal);
setTitleLabelForState(node, CCControlStateNormal);
setBackgroundSpriteForState(backgroundSprite, CCControlStateNormal);
setLabelAnchorPoint(ccp(0.5f, 0.5f));
// Layout update
needsLayout();
return true;
}
//couldn't init the CCControl
else
{
return false;
}
}