本文整理汇总了C++中CAView::setColor方法的典型用法代码示例。如果您正苦于以下问题:C++ CAView::setColor方法的具体用法?C++ CAView::setColor怎么用?C++ CAView::setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAView
的用法示例。
在下文中一共展示了CAView::setColor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toast
void UtilManager::toast(string text, CAViewController* object) {
CAApplication::getApplication()->getRootWindow()->removeSubviewByTag(TOAST_VIEW_TAG);
CCSize winSize = CAApplication::getApplication()->getWinSize();
//CAView *back = CAView::createWithCenter(CCRect(winSize.width*0.5, winSize.height*0.5, _dip(winSize.width)*0.3, _dip(winSize.height)*0.3));
CAView *back = CAView::createWithCenter(CCRect(winSize.width*0.5, winSize.height*0.5, 180 * getScale(), 30 * getScale()));
back->setTag(TOAST_VIEW_TAG);
back->setColor(ccc4(31, 31, 31, 200));//40
CALabel *title = CALabel::createWithCenter(CADipRect(_dip(back->getBounds().size.width*0.5),
_dip(back->getBounds().size.height*0.5), 180 * getScale(), 30 * getScale()));
// title->setText(UTF8ToGBK::transferToGbk(text));
title->setText(text);
//title->setText("sssss");
// title->setFontName(getChineseFont());
title->setColor(CAColor_white);
title->setTextAlignment(CATextAlignmentCenter);
title->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
title->setFontSize(_px(15));
back->addSubview(title);
//CAApplication::getApplication()->getRootWindow()->getRootViewController()->getView()->addSubview(back);
back->runAction(CCFadeOut::create(1));
//CAApplication::getApplication()->getRootWindow()->addSubview(back);
object->getView()->addSubview(back);
//CCLog("%s", get_date_now().c_str());
scheduleOnce(schedule_selector(UtilManager::removeToast), this, TOAST_TIME);
}
示例2: addGrayLine
void CATextToolBarView::addGrayLine(int x)
{
CCSize size = CAApplication::getApplication()->getWinSize();
CAView *line = createWithFrame(CCRect(x, 0, 1, size.height));
line->setColor(ccc4(206, 206, 211, 255));
m_pBackView->addSubview(line);
}
示例3: normalTableViewCell
void HeroInfoControllerCell::normalTableViewCell()
{
CAView* bg = dynamic_cast<CAView*>(this->getBackgroundView());
CC_RETURN_IF(bg == NULL);
bg->setColor(ccc4(255, 255, 255, 255));
}
示例4: collectionCellAtIndex
CACollectionViewCell* AutoCollectionViewHorizontalTest::collectionCellAtIndex(CAAutoCollectionView *collectionView, const DSize& cellSize, unsigned int section, unsigned int item)
{
CACollectionViewCell* p_Cell = collectionView->dequeueReusableCellWithIdentifier("CrossApp");
if (p_Cell == NULL)
{
p_Cell = CACollectionViewCell::create("CrossApp");
CAView* itemImage = CAView::createWithLayout(DLayoutFill);
itemImage->setTag(99);
p_Cell->getContentView()->addSubview(itemImage);
CALabel* itemText = CALabel::createWithLayout(DLayoutFill);
itemText->setTag(100);
itemText->setFontSize(29);
itemText->setTextAlignment(CATextAlignmentCenter);
itemText->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
p_Cell->getContentView()->addSubview(itemText);
}
CAView* itemImageView = p_Cell->getContentView()->getSubviewByTag(99);
itemImageView->setColor(HorizontalcolorArr.at(item));
CCLog("row = %d", item);
char pos[20] = "";
sprintf(pos, "(%d,%d)", section, item);
CALabel* itemText = (CALabel*)p_Cell->getContentView()->getSubviewByTag(100);
itemText->setText(pos);
return p_Cell;
}
示例5: onEnter
void CCTransitionFade :: onEnter()
{
CCTransitionScene::onEnter();
CCSize size = CCDirector::sharedDirector()->getWinSize();
CAView* l = CAView::createWithFrame(CCRect(0, 0, size.width, size.height));
l->setColor(ccc3(m_tColor.r, m_tColor.g, m_tColor.b));
l->setOpacity(m_tColor.a);
m_pInScene->setVisible(false);
l->setTag(kSceneFade);
insertSubview(l, 2);
CAView* f = getSubviewByTag(kSceneFade);
CCActionInterval* a = (CCActionInterval *)CCSequence::create
(
CCFadeIn::create(m_fDuration/2),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::hideOutShowIn)),//CCCallFunc::create:self selector:@selector(hideOutShowIn)],
CCFadeOut::create(m_fDuration/2),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)), //:self selector:@selector(finish)],
NULL
);
f->runAction(a);
}
示例6: disabledTableViewCell
void HeroViewControllerCell::disabledTableViewCell()
{
CAView* bg = dynamic_cast<CAView*>(this->getBackgroundView());
CC_RETURN_IF(bg == NULL);
bg->setColor(ccc4(127, 127, 127, 255));
}
示例7: tableCellAtIndex
CATableViewCell* ExchangeViewController::tableCellAtIndex(CATableView* table, const CCSize& cellSize, unsigned int section, unsigned int row)
{
CCLog("row = %d , section = %d", row, section);
CADipSize _size = cellSize;
CATableViewCell* p_Cell = p_TableView->dequeueReusableCellWithIdentifier("2155");
if (p_Cell == NULL )
{
p_Cell = CATableViewCell::create("2155");
p_Cell->setAllowsSelected(false);
CAView* itemImage = CAView::createWithFrame(CADipRect(0, 0, _size.width, _size.height));
itemImage->setColor(ccc4(244, 243, 243, 255));
itemImage->setTag(99);
p_Cell->addSubview(itemImage);
CADipSize itemSize = itemImage->getBounds().size;
CALabel* itemText = CALabel::createWithCenter(CADipRect(itemSize.width/2, itemSize.height/3, itemSize.width,40));
itemText->setTag(100);
itemText->setFontSize(_px(35));
itemText->setTextAlignment(CATextAlignmentCenter);
itemText->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
p_Cell->addSubview(itemText);
CALabel* itemText2 = CALabel::createWithCenter(CADipRect(itemSize.width/2, itemSize.height/5*4, itemSize.width,40));
itemText2->setTag(101);
itemText2->setFontSize(_px(25));
itemText2->setTextAlignment(CATextAlignmentCenter);
itemText2->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
p_Cell->addSubview(itemText2);
CAScale9ImageView* iv = CAScale9ImageView::createWithCenter(CADipRect(itemSize.width-50,itemSize.height/2,50,50));
iv->setImage(CAImage::create("source_material/cell_btn_right.png"));
iv->setTag(101);
p_Cell->addSubview(iv);
CAImageView* icon = CAImageView::createWithCenter(CADipRect(50,itemSize.height/2,64,64));
icon->setTag(101);
icon->setScale(0.6f);
icon->setImage(CAImage::create("source_material/btn_right_blue.png"));
p_Cell->addSubview(icon);
}
CALabel * label = (CALabel*)p_Cell->getSubviewByTag(100);
label->setText( unicode_to_utf8(exChangeMenuTag[row]) );
label->setColor(CAColor_black);
CALabel* label2 = (CALabel*)p_Cell->getSubviewByTag(101);
label2->setText(unicode_to_utf8(exChangeMenuTag2[row]));
label2->setColor(CAColor_gray);
return p_Cell;
}
示例8: highlightedTableViewCell
void HeroInfoControllerCell::highlightedTableViewCell()
{
CAView* bg = dynamic_cast<CAView*>(this->getBackgroundView());
CC_RETURN_IF(bg == NULL);
bg->setColor(COLOR_GRAY);
//m_pBackgroundView->setColor(ccc4(50, 193, 255, 255));
}
示例9: collectionCellAtIndex
CACollectionViewCell* CDUIShowCollectionView::collectionCellAtIndex(CACollectionView *collectionView, const CCSize& cellSize, unsigned int section, unsigned int row, unsigned int item)
{
if (row * 3 + item >= m_vTitle.size())
{
return NULL;
}
CADipSize _size = cellSize;
CACollectionViewCell* p_Cell = collectionView->dequeueReusableCellWithIdentifier("CrossApp");
if (p_Cell == NULL)
{
p_Cell = CACollectionViewCell::create("CrossApp");
p_Cell->setAllowsSelected(false);
CAView* itemImage = CAView::createWithFrame(CADipRect(0, 0, _size.width, _size.height));
itemImage->setTag(99);
p_Cell->addSubview(itemImage);
CADipSize itemSize = itemImage->getBounds().size;
CALabel* itemText = CALabel::createWithCenter(CADipRect(itemSize.width/2, itemSize.height-40, itemSize.width,40));
itemText->setTag(100);
itemText->setFontSize(_px(24));
itemText->setTextAlignment(CATextAlignmentCenter);
itemText->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
p_Cell->addSubview(itemText);
CAImageView* icon = CAImageView::createWithCenter(CADipRect(itemSize.width/2,itemSize.height/3,189,123));
icon->setTag(101);
icon->setScale(0.6f);
p_Cell->addSubview(icon);
}
CAView* itemImageView = p_Cell->getSubviewByTag(99);
itemImageView->setColor(ccc4(244, 243, 243, 255));
int index = row * 3 + item;
CALabel* itemText = (CALabel*)p_Cell->getSubviewByTag(100);
itemText->setText(m_vTitle.at(index));
itemText->setColor(ccc4(34,151,254,255));
CAImageView* icon = (CAImageView*)p_Cell->getSubviewByTag(101);
icon->setImage(CAImage::create(iconTag[index]));
return p_Cell;
}
示例10: collectionCellAtIndex
CACollectionViewCell* CDUIShowAutoCollectionView::collectionCellAtIndex(CAAutoCollectionView *collectionView, const DSize& cellSize, unsigned int section, unsigned int item)
{
CACollectionViewCell* p_Cell = collectionView->dequeueReusableCellWithIdentifier("CrossApp");
if (p_Cell == NULL)
{
p_Cell = CACollectionViewCell::create("CrossApp");
p_Cell->setAllowsSelected(false);
CAView* itemImage = CAView::createWithLayout(DLayout(DLayoutFill));
itemImage->setTag(99);
p_Cell->addSubview(itemImage);
CALabel* itemText = CALabel::createWithLayout(DLayout(DHorizontalLayout_L_R(0,0), DVerticalLayout_B_H(5,80)));
itemText->setTag(100);
itemText->setFontSize(24);
itemText->setTextAlignment(CATextAlignmentCenter);
itemText->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
p_Cell->addSubview(itemText);
CAImageView* icon = CAImageView::createWithLayout(DLayout(DHorizontalLayout_L_R(30,30),DVerticalLayout_T_H(20, 123)));
icon->setImageViewScaleType(CAImageViewScaleTypeFitImageInside);
icon->setTag(101);
icon->setScale(0.6f);
p_Cell->addSubview(icon);
}
CAView* itemImageView = p_Cell->getSubviewByTag(99);
itemImageView->setColor(ccc4(244, 243, 243, 255));
CALabel* itemText = (CALabel*)p_Cell->getSubviewByTag(100);
itemText->setText(m_vTitle.at(item));
itemText->setColor(ccc4(34, 151, 254, 255));
CAImageView* icon = (CAImageView*)p_Cell->getSubviewByTag(101);
icon->setImage(CAImage::create(iconTag[item]));
return p_Cell;
}
示例11: 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();
}