本文整理汇总了C++中CCScale9Sprite::setColor方法的典型用法代码示例。如果您正苦于以下问题:C++ CCScale9Sprite::setColor方法的具体用法?C++ CCScale9Sprite::setColor怎么用?C++ CCScale9Sprite::setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCScale9Sprite
的用法示例。
在下文中一共展示了CCScale9Sprite::setColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setOpacity
void CAIndicator::setOpacity(GLubyte opacity)
{
CCScale9Sprite* indicator = dynamic_cast<CCScale9Sprite*>(m_pIndicator);
if (indicator)
{
indicator->setOpacity(opacity);
indicator->setColor(ccc3(opacity, opacity, opacity));
}
}
示例2: CCSize
LayerChanToast::LayerChanToast(string message){
vector<string> lstRegex;
for( int i = 1; i <= 16; i++ ){
lstRegex.push_back( CCString::createWithFormat("(%d)", i)->getCString() );
}
this->setAnchorPoint(ccp(0, 0));
// text
cocos2d::ui::RichText* label = cocos2d::ui::RichText::create();
label->setAnchorPoint(ccp(0, 0));
label->setPosition(ccp(0, HEIGHT_DESIGN / 3.5));
vector<string> lstContents = mUtils::splitStringByListRegex(message, lstRegex);
int wLabel = 0, hLabel = 0;
for( int i = 0; i < lstContents.size(); i++ ){
bool check = false;
int j = 0;
for( j = 0; j < lstRegex.size(); j++ )
if( lstRegex.at(j) == lstContents.at(i) ){
check = true;
break;
}
if( check ){
CCArmature *armature = CCArmature::create(CCString::createWithFormat("onion%d", 1)->getCString());
armature->getAnimation()->playByIndex(j);
cocos2d::ui::RichElementCustomNode* recustom = cocos2d::ui::RichElementCustomNode::create(1, ccWHITE, 255, armature);
label->pushBackElement(recustom);
wLabel += 50;
hLabel = 55;
}else{
CCLabelTTF *l = CCLabelTTF::create(lstContents.at(i).c_str(), "Arial", 16);
l->setColor(ccc3(204, 16, 85));
cocos2d::ui::RichElementText* re1 = cocos2d::ui::RichElementText::create(1, ccWHITE, 255, lstContents.at(i).c_str(), "Arial", 16);
label->pushBackElement(re1);
wLabel += l->getContentSize().width;
hLabel = hLabel > 50 ? 55 : l->getContentSize().height;
}
}
this->addChild(label, 1, 0);
CCSize sizeDesign = CCSize(169, 30);
CCSpriteBatchNode *batchNode = CCSpriteBatchNode::create("chats/framechat_a.png");
CCScale9Sprite *blocks = CCScale9Sprite::create();
blocks ->updateWithBatchNode(batchNode , CCRect(0, 0, sizeDesign.width, sizeDesign.height), false, CCRect(10, 10, sizeDesign.width - 20, sizeDesign.height - 20));
CCSize size = CCSizeMake(wLabel + 10, hLabel + 5);
blocks ->setContentSize(size);
blocks->setAnchorPoint(ccp(0.5, 0.5));
blocks->setPosition(ccp(label->getPositionX() + wLabel / 2, label->getPositionY() + hLabel / 2));
blocks->setColor(ccc3(84, 81, 69));
blocks->setOpacity(200);
this->setPosition(ccp((WIDTH_DESIGN - size.width) / 2, 100));
// add
this->addChild(blocks);
}
示例3: onEnterTransitionDidFinish
void CAButton::onEnterTransitionDidFinish()
{
CAView::onEnterTransitionDidFinish();
if (this->CAControl::getBackGroundView() == NULL)
{
this->setBackGroundDefault();
}
if (this->getHighlightedBackGroundView() == NULL)
{
if (CCScale9Sprite* bg = dynamic_cast<CCScale9Sprite*>(this->CAControl::getBackGroundView()))
{
CCScale9Sprite* bgHighLighted = CCScale9Sprite::createWithImage(bg->getImage());
bgHighLighted->setPreferredSize(bg->getPreferredSize());
bgHighLighted->setColor(ccc3(127, 127, 127));
this->setBackGround(CAControlStateHighlighted, bgHighLighted);
}
else if (CAImageView* bg = dynamic_cast<CAImageView*>(this->CAControl::getBackGroundView()))
{
CAImageView* bgHighLighted = CAImageView::createWithImage(bg->getImage());
bgHighLighted->setBounds(bg->getBounds());
bgHighLighted->setColor(ccc3(127, 127, 127));
this->setBackGround(CAControlStateHighlighted, bgHighLighted);
}
else if (CAView* bg = dynamic_cast<CAView*>(this->CAControl::getBackGroundView()))
{
CAView* bgHighLighted = CAView::createWithFrame(bg->getFrame());
bgHighLighted->setColor(ccc3(bg->getColor().r/2, bg->getColor().g/2, bg->getColor().b/2));
this->setBackGround(CAControlStateHighlighted, bgHighLighted);
}
}
this->updateWithPoint();
this->setControlStateNormal();
}