本文整理汇总了C++中CImageView::getContentSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CImageView::getContentSize方法的具体用法?C++ CImageView::getContentSize怎么用?C++ CImageView::getContentSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CImageView
的用法示例。
在下文中一共展示了CImageView::getContentSize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CImageView *TuiManager::createImage(float tag, const char* file, float scaleX, float scaleY,float x, float y, float rotation){
CImageView *pImg = m_isUseSpriteFrame ? CImageView::createWithSpriteFrameName(file) : CImageView::create(file);
Size size = pImg->getContentSize();
pImg->setPosition(Point(x,-y));
pImg->setScale(scaleX, scaleY);
pImg->setRotation(rotation);
pImg->setTag(tag);
return pImg;
}
示例2:
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;
}
示例3: onTouchItem
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);
}
}
}
示例4: 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;
}
示例5: showTipsOnNextTotalSign
void CSignLayer::showTipsOnNextTotalSign()
{
m_pYellowTip->setVisible(false);
//遍历阶段签到
for (int i = 0; i < m_signData.totalList.size()&&i<4; i++)
{
CSign &sign = m_signData.totalList.at(i);
//未领取
if(sign.status==2)
{
if(sign.day>m_signData.sign)
{
//当前底加高亮
CCSprite* pBg = (CCSprite*)m_ui->findWidgetById(CCString::createWithFormat("bg%d",i+1)->getCString());
//pBg->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
pBg->setTexture(CCTextureCache::sharedTextureCache()->addImage("sign/arrival_02.png"));
//pBg->setScale(0.85f);
//拿到当前宝箱
CImageView *mask = (CImageView*)m_ui->findWidgetById(CCString::createWithFormat("mask%d",i+1)->getCString());
//隐藏自己的日期
CLabel *day = (CLabel*)(m_ui->findWidgetById(CCString::createWithFormat("day%d",i+1)->getCString()));
day->setVisible(false);
//加黄标提示
m_pYellowTip->setVisible(true);
m_pYellowTip->setPosition(ccp(mask->getPositionX()+mask->getContentSize().width/2, mask->getPositionY()+mask->getContentSize().height-60));
m_pYellowTipText->setString(day->getString());
break;
}
}
else
{
//当前底加高亮
CCSprite* pBg = (CCSprite*)m_ui->findWidgetById(CCString::createWithFormat("bg%d",i+1)->getCString());
//pBg->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault));
pBg->setTexture(CCTextureCache::sharedTextureCache()->addImage("sign/arrival_01.png"));
//pBg->setScale(1.0f);
//天数
CLabel *day = (CLabel*)(m_ui->findWidgetById(CCString::createWithFormat("day%d",i+1)->getCString()));
day->setVisible(true);
}
}
}
示例6: init
bool CSignLayer::init()
{
if (BaseLayer::init())
{
MaskLayer* lay = MaskLayer::create("CSignLayermask");
lay->setContentSize(CCSizeMake(2824,640));
LayerManager::instance()->push(lay);
m_ui = LoadComponent("Sign.xaml"); // SelectSkill
m_ui->setPosition(VCENTER);
this->addChild(m_ui);
this->setOpacity(180);
//背景框
CImageView* pImageRect = (CImageView*)m_ui->findWidgetById("board_sign");
//添加一个裁切层
CCClippingNode* pClip = CCClippingNode::create();
CImageView* pImage = UICloneMgr::cloneImageView(pImageRect);
pImage->setAnchorPoint(ccp(0.5f, 0.5f));
pImage->setPosition(ccp(pImage->getContentSize().width/2, pImage->getContentSize().height/2));
pClip->setStencil(pImage);
pClip->setContentSize(pImageRect->getContentSize());
pClip->setAnchorPoint(pImageRect->getAnchorPoint());
pClip->setPosition(pImageRect->getPosition());
pImageRect->getParent()->addChild(pClip, pImageRect->getZOrder()+1);
m_pClip = pClip;
//展示区图片
m_show_info_scroll = (CScrollView*)m_ui->findWidgetById("scroll_info");
m_show_info_scroll->setDirection(eScrollViewDirectionVertical);
m_show_info_scroll->setBounceable(true);
m_pInfo1 = (CLabel*)m_ui->findWidgetById("info_1");
CC_SAFE_RETAIN(m_pInfo1);
m_pInfo1->removeFromParentAndCleanup(false);
m_show_info_scroll->getContainer()->addChild(m_pInfo1);
m_pInfo1->setAnchorPoint(ccp(0, 1));
CC_SAFE_RELEASE(m_pInfo1);
m_pInfo2 = (CLabel*)m_ui->findWidgetById("info_2");
CC_SAFE_RETAIN(m_pInfo2);
m_pInfo2->removeFromParentAndCleanup(false);
m_show_info_scroll->getContainer()->addChild(m_pInfo2);
m_pInfo2->setAnchorPoint(ccp(0, 1));
CC_SAFE_RELEASE(m_pInfo2);
updateShowInfoScroll();
m_show_info_scroll->setVisible(false);
CCNode* pMaskInfo = (CCNode*)m_ui->findWidgetById("mask_info");
pMaskInfo->setVisible(false);
m_pLineEffect = new CLineLightEffect;
m_pLineEffect->bindUI(m_ui);
m_pLineEffect->bindRectEffect(pImageRect);
this->addChild(m_pLineEffect, 999);
m_pYellowTip = CCSprite::create("sign/lightbox5.png");
m_pYellowTip->setAnchorPoint(ccp(0.5f, 0.0f));
m_pYellowTip->setScale(0.8f);
m_pYellowTip->runAction(CCRepeatForever::create(CCSequence::createWithTwoActions(CCMoveBy::create(0.3f, ccp(0, -10)), CCMoveBy::create(0.3f, ccp(0, 10)))));
m_ui->addChild(m_pYellowTip, 50);
m_pYellowTipText = UICloneMgr::cloneLable((CLabel*)m_ui->findWidgetById("day1"));
m_pYellowTipText->setAnchorPoint(ccp(0.5f, 0.5f));
m_pYellowTipText->setPosition(ccp(m_pYellowTip->getContentSize().width/2, m_pYellowTip->getContentSize().height/2+12));
m_pYellowTipText->setScale(1.2f);
m_pYellowTip->addChild(m_pYellowTipText);
m_pYellowTip->setVisible(false);
return true;
}
return false;
}
示例7: addGridCell
void CSignLayer::addGridCell(unsigned int uIdx, CGridViewCell* pCell)
{
// CHero *hero = m_currHeroList->at(uIdx);
CSign &sign = m_signData.signList.at(uIdx);
CLayout *lay = UICloneMgr::cloneLayout(m_cell);
pCell->setScale(0.97f);
for (int i = 1; i <=4; i++)
{
CCNode *child = lay->getChildByTag(i);
lay->removeChild(child);
pCell->addChild(child);
}
CImageView *imagView = (CImageView*)pCell->getChildByTag(1);
imagView->setTouchEnabled(true);
imagView->setEnabled(true);
imagView->setUserData(&m_signData.signList.at(uIdx));
imagView->setOnPressListener(this, ccw_press_selector(CSignLayer::onPress));
CCSprite *item = nullptr;
if (sign.prize.thumb>=0)
{
CImageView * pMask = (CImageView*)pCell->getChildByTag(2);
SmartSetRectPrizeColor(pMask, &sign.prize);
item = CCSprite::create(GetImageName(sign.prize.type, sign.prize.color, sign.prize.thumb).c_str());
if(!item)
{
item = CCSprite::create("headImg/101.png");
CCLOG("CSignLayer::addGridCell error load image %d", sign.prize.thumb);
}
item->setPosition(ccp(pMask->getContentSize().width/2, pMask->getContentSize().height/2));
pMask->addChild(item, -1, 2);
item->setScale(0.9f);
//加数字
CCLabelAtlas* haveNum = CCLabelAtlas::create("", "label/no_02.png", 9, 15, 46);
haveNum->setAnchorPoint(ccp(1.0f, 0.0f));
haveNum->setPosition(ccp(85, 5));
pMask->addChild(haveNum, 99, 99);
haveNum->setString(ToString(sign.prize.num));
if(sign.prize.num<=1)
{
haveNum->setVisible(false);
}
//添加星星
if(sign.prize.quality > 0)
{
CLayout* pStarLayout = SmartGetStarLayout(&sign.prize);
pMask->addChild(pStarLayout, 211, 211);
}
}
//vip icon
CCSprite *vip = (CCSprite*)pCell->getChildByTag(3);
if (sign.vip>0)
{
CCTexture2D *texture = CCTextureCache::sharedTextureCache()
->addImage(CCString::createWithFormat("public/vip_%d.png",sign.vip)->getCString());
vip->setVisible(true);
vip->setTexture(texture);
}
else
{
vip->setVisible(false);
}
switch (sign.status)
{
//没签
case 2:
{
//对勾
pCell->getChildByTag(4)->setVisible(false);
//考虑是否加个框标示为可签
if(uIdx == m_signData.sign &&
(m_signData.bCanSign || (m_signData.bCanResign && m_signData.resign>0) ) )
{
CImageView * pMask = (CImageView*)pCell->getChildByTag(2);
CCSprite* pRect = CCSprite::create("common/box_light.png");
pRect->setPosition(ccp(pMask->getPositionX()+pMask->getContentSize().width/2, pMask->getPositionY()+pMask->getContentSize().height/2));
pCell->addChild(pRect, 100);
pRect->runAction(CCRepeatForever::create(CCSequence::createWithTwoActions(CCScaleTo::create(0.3f, 1.03f), CCScaleTo::create(0.3f, 1.0f))));
}
}
break;
//已签
case 1:
{
//对勾
pCell->getChildByTag(4)->setVisible(true);
//变黑
pCell->getChildByTag(1)->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
pCell->getChildByTag(2)->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
//.........这里部分代码省略.........
示例8: addTableCell
void CStrengthenItem::addTableCell(unsigned int uIdx, CTableViewCell * pCell)
{
CLayout *lay = UICloneMgr::cloneLayout(m_cell);
CItem &item = *(m_itemList.at(uIdx));// m_itemData.itemList.at(uIdx);
pCell->setTag(uIdx);
const ItemData * itemData = DataCenter::sharedData()->getItemDesc()->getCfg(item.itemId);
for (int i = 1; i <=11; i++)
{
CCNode *child = lay->getChildByTag(i);
if (!child) continue;
lay->removeChild(child);
pCell->addChild(child);
if (i==1)
{
CImageView *bgImg = (CImageView*)child;
if (m_toHero>0)
{
if (!item.canUse&&item.armor.hero!=m_toHero)
{
CColorView *colorView = CColorView::create(ccc4(0,0,0,100));
colorView->setContentSize(bgImg->getContentSize());
colorView->setPosition(bgImg->getPosition());
pCell->addChild(colorView,1);
}
if(item.armor.hero<=0)
{
//记录库存
m_iCountEquipStock++;
}
}
bgImg->setTouchEnabled(true);
bgImg->setUserData(m_itemList.at(uIdx));
bgImg->setOnClickListener(this,ccw_click_selector(CStrengthenItem::onTouchItem));
}
else if (i==2)
{
((CButton*)child)->setEnabled(false);
CCSprite *mask = CCSprite::createWithTexture(setItemQualityTexture(item.quality));
mask->setPosition(ccp(child->getContentSize().width/2,child->getContentSize().height/2));
child->addChild(mask, 10);
CCSprite *prop = CCSprite::create(GetImageName(1, item.quality, item.iconId).c_str());
if (!prop)
{
prop = CImageView::create("prop/32003.png");
}
prop->setPosition(ccp(child->getContentSize().width/2,child->getContentSize().height/2));
child->addChild(prop);
//添加星星
CLayout* pStarLayout = getStarLayout(item.iStar);
child->addChild(pStarLayout, 10);
}
else if (i==3)
{
CLabel *label = (CLabel*)child;
if(itemData)
{
label->setString(itemData->itemName.c_str());
}
}
else if (i==4)
{
CLabel *label = (CLabel*)child;
if (item.itemLevel==0)
{
label->removeFromParent();
}
else
{
label->setString(CCString::createWithFormat("+%d",item.itemLevel)->getCString());
label->setPositionX(pCell->getChildByTag(3)->getPositionX()+pCell->getChildByTag(3)->getContentSize().width+10);
}
}
else if (i==5)
{
CLabel *label = (CLabel*)child;
if (item.itemLevel==0)
{
label->setVisible(false);
}
else
{
label->setVisible(true);
//if (item.itemLevel==item.armor.strenLv)
//{
// label->setString(CCString::createWithFormat("Lv.%s",GETLANGSTR(229))->getCString());
//}
//else
//{
// label->setString(CCString::createWithFormat("Lv.%d",item.itemLevel)->getCString());
//}
//.........这里部分代码省略.........