本文整理汇总了C++中CImageView::setTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ CImageView::setTexture方法的具体用法?C++ CImageView::setTexture怎么用?C++ CImageView::setTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CImageView
的用法示例。
在下文中一共展示了CImageView::setTexture方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addTableCell
void CSharpTollgate::addTableCell(unsigned int uIdx, CTableViewCell * pCell)
{
const vector<StageWidget> *data = DataCenter::sharedData()->getStageData()
->getStageWidgets(m_chapter);
CStage &stage = m_stageList.at(uIdx);
for (int i = 0; i < 2; i++)
{
CCNode * node = (CCNode*)m_cell->getChildren()->objectAtIndex(i);
if (node->getTag()==1)
{
const StageWidget *widget = nullptr;
CCString *strId = CCString::createWithFormat("hero%d",uIdx+1);
for (int j=0; j<data->size();++j)
{
widget = &data->at(j);
if (widget->widgetId!=""&&widget->widgetId.compare(strId->getCString())==0)
{
CButton *btn = CButton::create(widget->normalImage.c_str());
btn->setScaleX(widget->scaleX);
btn->setScaleY(widget->scaleY);
btn->setPosition(ccp(100, 80/*btn->boundingBox().size.height*/));
btn->setAnchorPoint(ccp(0.5, 0.0));
btn->setUserData(&m_stageList.at(uIdx));
btn->setOnClickListener(this,ccw_click_selector(CSharpTollgate::onBattle));
btn->setTag(1);
pCell->addChild(btn);
if (!stage.isOpen)
{
btn->getNormalImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
// btn->getSelectedImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
}
break;
}
}
}
else if (node->getTag()==2)
{
CImageView *image = UICloneMgr::cloneImageView((CImageView*)node);
if (stage.star>0)
{
image->setTexture(CCTextureCache::sharedTextureCache()->addImage(CCString::createWithFormat("tollgate/star_%d.png",stage.star)->getCString()));
}
else
{
image->setTexture(CCTextureCache::sharedTextureCache()->addImage("tollgate/star_3.png"));
image->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
}
image->setAnchorPoint(ccp(0.5f,0));
pCell->addChild(image);
}
}
pCell->setVisible(false);
pCell->setScale(1.15f);
pCell->runAction(CCSequence::create(CCDelayTime::create(0.1f+0.15f*uIdx),CCShow::create(),CCScaleTo::create(0.05f,1.0f),CCCallFuncN::create(this,callfuncN_selector(CSharpTollgate::heroCall)),nullptr));
}
示例2: setStageList
void CSharpTollgate::setStageList(const vector<CStage>& stageList, int chapter, int openChapter)
{
m_stageList = stageList;
m_chapter = chapter;
m_openChapter = openChapter;
m_tableView->setCountOfCell(stageList.size());
m_tableView->reloadData();
CTableViewCell *cell = m_tableView->cellAtIndex(3);
cell->setPositionX(cell->getPositionX()+115);
CImageView *name = (CImageView*)(m_ui->findWidgetById("name"));
CCTexture2D *texture = CCTextureCache::sharedTextureCache()->addImage(CCString::createWithFormat("tollgate/chapter_%d.png",chapter)->getCString());
if(!texture)
{
texture = CCTextureCache::sharedTextureCache()->addImage("tollgate/chapter_1.png");
}
name->setTexture(texture);
name->setTextureRect(CCRectMake(0,0,texture->getContentSize().width,texture->getContentSize().height));
}
示例3: addTableCell
void CHandBookHeroLayer::addTableCell( unsigned int uIdx, CTableViewCell * pCell )
{
//先克隆外框条
CLayout *pLay = UICloneMgr::cloneLayout(m_pCellBlank);
//对应数据
AtlasIns *pAtlasIns = m_AtlasResponse.mutable_atlas_list()->Mutable(uIdx);
//赋值
for (unsigned int i=1; i<=10; i++)
{
CCNode *child = pLay->getChildByTag(i);
pLay->removeChild(child);
child->setTag(i);
pCell->addChild(child);
pCell->setTag(uIdx);
}
//1-活动底板
{
CImageView* pBoard = dynamic_cast<CImageView*>(pCell->getChildByTag(1));
pBoard->setTouchEnabled(true);
pBoard->setOnClickListener(this, ccw_click_selector(CHandBookHeroLayer::onClickBlank));
if ( uIdx==m_iSelectIndex )
{
pBoard->setTexture(CCTextureCache::sharedTextureCache()->addImage("handBook/bookbg_2.png"));
}
else
{
pBoard->setTexture(CCTextureCache::sharedTextureCache()->addImage("handBook/bookbg_1.png"));
}
}
//2-组合名字
{
CLabel* pLabel = dynamic_cast<CLabel*>(pCell->getChildByTag(2));
}
//3-//组合描述
{
CLabel* pLabel = dynamic_cast<CLabel*>(pCell->getChildByTag(3));
}
//4-礼品背景
//5-礼品
//10-文字
{
CImageView* pGiftBg = dynamic_cast<CImageView*>(pCell->getChildByTag(4));
CImageView* pGift = dynamic_cast<CImageView*>(pCell->getChildByTag(5));
CLabel* pLabel = dynamic_cast<CLabel*>(pCell->getChildByTag(10));
pLabel->setVisible(false);
pGift->stopAllActions();
//奖励领取标志 0未领取(不可领取),1未领取(可领取状态),2 已领取
switch (pAtlasIns->get_prize())
{
case 0:
{
pGiftBg->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
pGift->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
}break;
case 1:
{
pGiftBg->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault));
pGift->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault));
ResetAnchorPointAndKeepSamePos(pGift, CCPointCenter);
pGift->runAction(CCRepeatForever::create(CCSequence::createWithTwoActions(CCScaleTo::create(0.3f, 0.75f), CCScaleTo::create(0.3f, 0.7f))));
}break;
case 2:
{
pGiftBg->setVisible(false);
pGift->setVisible(false);
pLabel->setVisible(true);
}break;
default:
break;
}
}
//7-进度条
//8-进度数字
//9-进度图标
{
CProgressBar* pProgress = dynamic_cast<CProgressBar*>(pCell->getChildByTag(7));
CLabel* pLabel = dynamic_cast<CLabel*>(pCell->getChildByTag(8));
pLabel->setTouchEnabled(true);
pLabel->setOnClickListener(this, ccw_click_selector(CHandBookHeroLayer::onClickScoreIcon));
CImageView* pIcon = dynamic_cast<CImageView*>(pCell->getChildByTag(9));
pIcon->setTouchEnabled(true);
pIcon->setOnClickListener(this, ccw_click_selector(CHandBookHeroLayer::onClickScoreIcon));
}
//.........这里部分代码省略.........