本文整理汇总了C++中CImageView类的典型用法代码示例。如果您正苦于以下问题:C++ CImageView类的具体用法?C++ CImageView怎么用?C++ CImageView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CImageView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void CMainWindow::onCommand (xl::uint id, xl::ui::CControlPtr /*ctrl*/) {
switch (id) {
case ID_NAV_NEXT:
cmdNext();
break;
case ID_NAV_PREV:
cmdPrev();
break;
case ID_NAV_ZOOMIN:
case ID_NAV_ZOOMOUT:
case ID_NAV_SWITCH:
{
CImageView *pView = (CImageView *)m_view.get();
assert(pView);
if (id == ID_NAV_ZOOMIN) {
pView->showLarger(CPoint(-1, -1));
} else if (id == ID_NAV_ZOOMOUT) {
pView->showSmaller(CPoint(-1, -1));
} else {
pView->showSwitch(CPoint(-1, -1));
}
}
break;
case ID_SETTING:
// launchAssociation();
{
m_toolbar->setOpacity(0);
CSettingDialog dlg(&m_gestureMap);
dlg.DoModal(m_hWnd);
}
break;
default:
break;
}
}
示例2: GetImageName
void CHandBookHeroLayer::initCellIconByData( AData *pAData, CLayout *pCell )
{
//message AData{
// optional int32 type = 1; //类型 1英雄,2装备,3怪物
// optional int32 thumb = 2;
// optional int32 color = 3; //边框颜色
// optional int32 process = 4; //英雄、装备代表进阶数,怪物代表击杀数
// optional int32 max_process = 5;
// optional int32 param = 6;
//}
Prize *prize = new Prize;
//获取数据
int iType = 1;
if ( pAData->type()==1 || pAData->type()==3 )
{
iType = 2;
}
int iColor = pAData->color();
int iIconId = pAData->thumb();
int iRank = pAData->process();
string str = GetImageName(iType, iColor, iIconId);
//图标
CImageView* pBgRect = (CImageView *)pCell->findWidgetById("headBg");
CImageView *itemSpr = CImageView::create(str.c_str());
if (!itemSpr)
{
itemSpr = CImageView::create("prop/32003.png");
CCLOG("[ ERROR ] CPopItem::addTableCell Lost Image = %d");
}
pBgRect->addChild(itemSpr);
NodeFillParent(itemSpr);
//品质+事件
CImageView *mask= (CImageView *)pCell->findWidgetById("head");
mask->setTexture(setItemQualityTexture(iColor));
mask->setUserData(pAData);
mask->setTag(iType);
mask->setTouchEnabled(true);
mask->setOnClickListener(this, ccw_click_selector(CHandBookHeroLayer::onShowRankUp));
//进阶
for ( int i=0; i<5; i++)
{
CImageView *pStar = (CImageView *)pCell->getChildByTag(i+3);
//阶级到,点亮
if (i<iRank)
{
pStar->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault));
}
else
{
pStar->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
}
}
}
示例3: if
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));
}
示例4: callBackForTotalSignUiUpdate
void CSignLayer::callBackForTotalSignUiUpdate()
{
CImageView* pSprite = (CImageView*)m_ui->findWidgetById("mask_copy");
pSprite->removeFromParentAndCleanup(true);
//更新阶段签到情况
updateTotoalSign();
//加黄标提示
showTipsOnNextTotalSign();
}
示例5: PlayEffectSound
void CChangeHeadImg::onChangHeadImg(CCObject* pSender)
{
PlayEffectSound(SFX_Button);
CImageView *head = (CImageView *)pSender;
int *icon = (int*)head->getUserData();
CPlayerControl::getInstance().sendChangeHeadImg(*icon);
LayerManager::instance()->pop();
LayerManager::instance()->pop();
}
示例6: CImageView
CImageView* CImageView::createWithTexture(CCTexture2D *pTexture, const CCRect& rect)
{
CImageView *pobSprite = new CImageView();
if (pobSprite && pobSprite->initWithTexture(pTexture, rect))
{
pobSprite->autorelease();
return pobSprite;
}
CC_SAFE_DELETE(pobSprite);
return NULL;
}
示例7: CImageView
CImageView* CImageView::create(const char *pszFileName, const CCRect& rect)
{
CImageView *pobSprite = new CImageView();
if (pobSprite && pobSprite->initWithFile(pszFileName, rect))
{
pobSprite->setTouchEnabled(false);
pobSprite->autorelease();
return pobSprite;
}
CC_SAFE_DELETE(pobSprite);
return NULL;
}
示例8: PlayEffectSound
void CStrengthenItem::onTouchItem(CCObject* pSender)
{
if(isVisible())
{
PlayEffectSound(SFX_Button);
}
CImageView * img = (CImageView*)pSender;
m_item = (CItem*)img->getUserData();
m_pItemTip->showItemProperty(m_item);
CLayout *attribute = (CLayout*)(m_ui->findWidgetById("attr"));
attribute->setVisible(true);
m_selectCellImg->removeFromParent();
img->addChild(m_selectCellImg);
m_selectCellImg->setVisible(true);
m_selectCellImg->setPosition(ccp(img->getContentSize().width/2,0/*img->getContentSize().height/2*/));
CButton *select = (CButton*)(m_ui->findWidgetById("select")); //sel_font
CLabel *selfont = (CLabel*)(m_ui->findWidgetById("sel_font"));
if (m_toHero==m_item->armor.hero&&m_toHero>0)
{
select->setVisible(true);
selfont->setVisible(false);
}
else if (m_toHero>0&&!m_item->canUse)
{
select->setVisible(false);
selfont->setVisible(false);
}
else
{
select->setVisible(true);
selfont->setVisible(true);
}
if (m_type==2)
{
if (m_toHero>0)
{
CImageView *uninstall = (CImageView*)(m_ui->findWidgetById("uninstall"));
CImageView *change = (CImageView*)(m_ui->findWidgetById("change"));
CImageView *selfont = (CImageView*)(m_ui->findWidgetById("sel_font"));
uninstall->setVisible(m_toHero==m_item->armor.hero);
change->setVisible(m_toHero!=m_item->armor.hero&&m_item->armor.hero>0&&m_item->canUse);
selfont->setVisible(m_item->armor.hero==0&&m_item->canUse);
}
}
}
示例9: ccw_click_selector
void CTopLayer::onEnter()
{
BaseLayer::onEnter();
this->setTouchPriority(-100);
UserData *user = DataCenter::sharedData()->getUser()->getUserData();
m_coinLabel = (CLabel*)m_ui->getChildByTag(13);
m_coinLabel->setString(ToString(user->getCoin()));
m_moneyLabel = (CLabel*)m_ui->getChildByTag(14);
m_moneyLabel->setString(ToString(user->getRoleGold()));
//
m_foodLabel = (CLabel*)m_ui->getChildByTag(17);
//m_foodLabel->setString(ToString(user->getRoleFood()));
m_foodLabel->setString(ToString(user->getFriends()));
CLabel *action = (CLabel*)(m_ui->findWidgetById("action"));
action->setString(CCString::createWithFormat("%d/%d",user->getRoleAction(),user->getActionLimit())->getCString());
CButton* add_food = (CButton*)m_ui->findWidgetById("btn_add_food");
CButton* add_copper = (CButton*)m_ui->findWidgetById("btn_add_copper");
CButton* add_soul = (CButton*)m_ui->findWidgetById("btn_add_soul");
CButton* add_gold = (CButton*)m_ui->findWidgetById("btn_add_gold");
CButton* add_friendship = (CButton*)m_ui->findWidgetById("btn_add_friendship");
add_food->getSelectedImage()->setScale(1.1f);
add_copper->getSelectedImage()->setScale(1.1f);
add_soul->getSelectedImage()->setScale(1.1f);
add_gold->getSelectedImage()->setScale(1.1f);
add_friendship->getSelectedImage()->setScale(1.1f);
add_food->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
add_copper->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
add_soul->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
add_gold->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
add_friendship->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_HERO,this,GameMsghandler_selector(CTopLayer::updateRoleProperty));
//绑定场景隐藏和显示的消息
NOTIFICATION->addObserver(this, callfuncO_selector(CTopLayer::show), SHOW_TOP_LAYER, nullptr);
NOTIFICATION->addObserver(this, callfuncO_selector(CTopLayer::hide), HIDE_TOP_LAYER, nullptr);
CImageView *coin = (CImageView*)(m_ui->findWidgetById("coin"));
CCAnimation *coinAnim = AnimationManager::sharedAction()->getAnimation("7033");
coinAnim->setDelayPerUnit(0.3f);
coin->runAction(CCRepeatForever::create(CCAnimate::create(coinAnim)));
CImageView *gold = (CImageView*)(m_ui->findWidgetById("gold"));
CCAnimation *goldAnim = AnimationManager::sharedAction()->getAnimation("7034");
goldAnim->setDelayPerUnit(0.3f);
gold->runAction(CCRepeatForever::create(CCAnimate::create(goldAnim)));
}
示例10: GetDCImage
bool GetDCImage( CImage32* dest, HDC dc, int width, int height )
{
dest->Resize( width, height );
CImageView* tmp = new CImageView( dest->Width(), dest->Height() );
BitBlt( tmp->hDC(), 0,0, width,height, dc, 0,0, SRCCOPY );
dest->Blt( 0,0, tmp );
dest->Filter( FLT_OR, Bpp32(0xFF000000) );
delete tmp;
return TRUE;
}
示例11: Rect
CImageViewScale9 *TuiManager::createImage9(float tag,const char* file,float x,float y,float w,float h,float up,float down,float left, float right,float rotation){
CImageViewScale9* pSprite = NULL;
if(m_isUseSpriteFrame){
pSprite = CImageViewScale9::createWithSpriteFrameName(file,Rect(up,down,left,right));
}else{
CImageView *temp = CImageView::create(file);
Size size = temp->getContentSize();
pSprite = CImageViewScale9::create(file, Rect(0,0,size.width,size.height),Rect(up,down,left,right));
}
pSprite->setContentSize(Size(w,h));
pSprite->setPosition(Point(x,-y));
pSprite->setRotation(rotation);
pSprite->setTag(tag);
return pSprite;
}
示例12: CCLOG
void CChangeHeadImg::addGridCell(unsigned int uIdx, CGridViewCell* pCell)
{
CLayout *lay = UICloneMgr::cloneLayout(m_cell);
for (int i=1; i<=2; i++)
{
CCNode *child = lay->getChildByTag(i);
lay->removeChild(child);
pCell->addChild(child);
if (i==1)
{
if (m_headIconList.at(uIdx)>0)
{
CImageView* pHead = CImageView::create(CCString::createWithFormat("headImg/%d.png", m_headIconList.at(uIdx))->getCString());
if(!pHead)
{
pHead = CImageView::create("headImg/null.png");
CCLOG("ERROR_____CChangeHeadImg::addGridCell");
}
child->addChild(pHead);
NodeFillParent(pHead);
}
else
{
UserData *data = DataCenter::sharedData()->getUser()->getUserData();
string fbName = data->getFbId() +".jpg";
string fullName = CCFileUtils::sharedFileUtils()->fullPathForFilename(fbName.c_str());
bool isFileExist = CCFileUtils::sharedFileUtils()->isFileExist(fullName);
if(isFileExist)
{
CCSprite* spr =CCSprite::create(fullName.c_str());
child->addChild(spr);
NodeFillParent(spr);
}
}
}
else if(i==2)
{
CImageView* pBtn = (CImageView*)child;
pBtn->setTouchEnabled(true);
pBtn->setUserData(&m_headIconList.at(uIdx));
pBtn->setOnClickListener(this,ccw_click_selector(CChangeHeadImg::onChangHeadImg));
}
}
}
示例13: PlayEffectSound
void LoginLayerUC::selectServer( CCObject* pObj )
{
PlayEffectSound(SFX_Button);
CImageView* pImageView = (CImageView*)pObj;
if(m_iSelectServerIndex != pImageView->getParent()->getTag())
{
m_iSelectServerIndex = pImageView->getParent()->getTag();
CNetClient *tcp = CNetClient::getShareInstance();
if (tcp->isConnected())
{
tcp->close();
}
}
updateSelectServer();
hideServerList();
}
示例14:
CImageView *TuiManager::createImage(float tag, const char* file, float scaleX, float scaleY, int flipX, int flipY, float x, float y, float rotation, int isUseFrame){
CImageView *pImg = isUseFrame ? CImageView::createWithSpriteFrameName(file) : CImageView::create(file);
Size size = pImg->getContentSize();
pImg->setPosition(Vec2(x,-y));
pImg->setFlippedX(flipX == 1);
pImg->setFlippedY(flipY == 1);
pImg->setScale(scaleX, scaleY);
pImg->setRotation(rotation);
pImg->setTag(tag);
return pImg;
}
示例15: ccw_press_selector
void CSignLayer::updateTotoalSign()
{
//更新
//已领取的,宝箱变灰,加对勾
//未领取的,宝箱变亮,
//将要领取的,加黄色标题突出
for (int i = 0; i < m_signData.totalList.size()&&i<4; i++)
{
CSign &sign = m_signData.totalList.at(i);
//宝箱
CImageView *mask = (CImageView*)m_ui->findWidgetById(CCString::createWithFormat("mask%d",i+1)->getCString());
mask->setVisible(true);
//mask->setTexture(CCTextureCache::sharedTextureCache()->addImage(CCString::createWithFormat("sign/box_%d.png", i+1)->getCString()));
mask->setUserData(&sign);
mask->setTouchEnabled(true);
mask->setOnPressListener(this, ccw_press_selector(CSignLayer::onPress));
//天数
CLabel *day = (CLabel*)(m_ui->findWidgetById(CCString::createWithFormat("day%d",i+1)->getCString()));
day->setString(CCString::createWithFormat(GETLANGSTR(209),sign.day)->getCString());
//获得字样
CImageView *getspr = (CImageView*)(m_ui->findWidgetById(CCString::createWithFormat("get%d",i+1)->getCString()));
//已领取
if (sign.status==1)
{
//宝箱变灰
mask->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
//加对勾
getspr->setVisible(true);
}
//未领取
else if(sign.status==2)
{
//宝箱变灰
mask->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault));
//加对勾
getspr->setVisible(false);
}
}
}