本文整理汇总了C++中BaseSprite::getPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseSprite::getPosition方法的具体用法?C++ BaseSprite::getPosition怎么用?C++ BaseSprite::getPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseSprite
的用法示例。
在下文中一共展示了BaseSprite::getPosition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: select
void GongJiang_EquipSelect::select()
{
CCTableViewCell* lastCell = mTableView->cellAtIndex(0);
if (lastCell)
{
BaseSprite* bg = (BaseSprite*)lastCell->getChildByTag(TAG_EquipBaseBody_TABLE_ITEM);
bool isFirstIn = false;
// 先不管是否点击了图片
if(GameGuideManager::getManager()->isGuideNow(GameGuideManager::GID_GongJiang_QiangHua))
{
//GameGuideManager::getManager()->setOneGuideStart(GameGuideManager::GID_GongJiang_SelectZhuangBei);
//GameGuideManager::getManager()->setOneGuideEnd(GameGuideManager::GID_GongJiang_SelectZhuangBei);
if (bg)
{
CCPoint pos = bg->getParent()->convertToWorldSpace(bg->getPosition());
GuideLayerBase *guideLayer1 = new GuideLayer_SimpleLayer;
guideLayer1->init(bg->getContentSize(), ccp(pos.x,pos.y + bg->getContentSize().height / 2)
, LFStrings::getValue("qiangxuanzezhuangbei"), NULL, false);
//((GuideLayer_SimpleLayer*)guideLayer1)->setCallBack(this,SEL_CallFunc(&JiuGongGeLayer::GuiDeLayerCallBack));
CCDirector::sharedDirector()->getRunningScene()->addChild(guideLayer1, 128);
}
}
}
}
示例2: tableCellAtIndex
CCTableViewCell* TanSuoLayer::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
CCTableViewCell *cell = table->dequeueCell();
if (cell != NULL)
{
cell->removeAllChildren();
}
else
{
cell = new CCTableViewCell();
cell->autorelease();
}
if (table->getParent() != NULL)
{
CCSize cellSize = tableCellSizeForIndex(table, idx);
Profession profId = mHeros.at(idx)->getCurrentProperty().profession;
//head Profession 1-10
BaseSprite *headImg = BaseSprite::create(ImageManager::getManager()->getImageData_ProfessionHead(profId).getCurrentImageFile());
cell->addChild(headImg);
headImg->setPosition(ccp(cellSize.width/2, 92));
//menu
FXScrollMenu *menu = FXScrollMenu::create(
table->getParent()->convertToWorldSpace(table->getPosition()), table->getViewSize());
cell->addChild(menu, 1);
menu->setPosition(ccp(0,0));
CCMenuItemImage *item = CCMenuItemImage::create(
"renxing_renwu_touxiang.png",
"renxing_renwu_touxiang_select.png",
"renxing_renwu_touxiang_select.png",
this, menu_selector(TanSuoLayer::menuItemClicked_JieFenHeroSelect));
menu->addChild(item, 0, profId);
m_lMenuItemList.push_back(item);
item->setPosition(headImg->getPosition());
//name
CCLabelTTF *nameLabel = CCLabelTTF::create(BaseActorPropertyParser::getParser()->getExtraProerty(profId).nameInChinese.c_str()
, fontStr_kaiti, m_nFontSize);
cell->addChild(nameLabel);
nameLabel->setPosition(ccp(headImg->getPositionX()
, headImg->getPositionY()-headImg->getContentSize().height/2-nameLabel->getContentSize().height/2));
nameLabel->setColor(ccc3(195, 145, 96));
}
return cell;
}
示例3: getItemContentByIndex
BaseSprite* MainLayerHerosBaseBody::getItemContentByIndex(unsigned int index)
{
BaseSprite* bg = BaseSprite::create("duiwu_yingxiong_bg.png");
bg->setPosition(ccp(bg->getContentSize().width/2,bg->getContentSize().height/2));
//图片
{
ImageData data = ImageManager::getManager()->getImageData_ProfessionHead((Profession)mHerosVec[index]->getActorType());
CCLOG("----------------->%s",data.getCurrentImageFile().c_str());
BaseSprite *sprite = BaseSprite::create( data.getCurrentImageFile());
BaseSprite *sprite2 = BaseSprite::create( data.getCurrentImageFile());
BaseSprite *sprite3 = BaseSprite::create( data.getCurrentImageFile());
CCMenuItemSprite* heroItem = CCMenuItemSprite::create(sprite, sprite2, sprite3, this, menu_selector(MainLayerHerosBaseBody::menuItemClicked_heroImg));
CCMenu* menu = CCMenu::create(heroItem, NULL);
bg->addChild(menu, 0, TAG_BaseBody_TABLE_HERO_IMG);
heroItem->setPosition(ccp(74, bg->getContentSize().height/2));
menu->setPosition(CCPointZero);
BaseSprite *biankuang = BaseSprite::create("renxing_renwu_touxiang_select.png");
bg->addChild(biankuang, 1);
biankuang->setPosition(heroItem->getPosition());
BaseSprite *item = NULL;
Profession iType = (Profession)mHerosVec[index]->getActorType();
if (iType == Profession_Yemanren)
{
item = BaseSprite::create("touxiang_jiaobiao_3.png");
}
else if (iType == Profession_Chike)
{
item = BaseSprite::create("touxiang_jiaobiao_2.png");
}
else if (iType == Profession_Fashi)
{
item = BaseSprite::create("touxiang_jiaobiao_1.png");
}
else if (iType == Profession_Qishi)
{
item = BaseSprite::create("touxiang_jiaobiao_3.png");
}
else if (iType == Profession_ShenJianShou)
{
item = BaseSprite::create("touxiang_jiaobiao_4.png");
}
else if (iType == Profession_MiShu)
{
item = BaseSprite::create("touxiang_jiaobiao_1.png");
}
else if (iType == Profession_WuSeng)
{
item = BaseSprite::create("touxiang_jiaobiao_5.png");
}
else if (iType == Profession_YouXia)
{
item = BaseSprite::create("touxiang_jiaobiao_2.png");
}
else if (iType == Profession_LieShou)
{
item = BaseSprite::create("touxiang_jiaobiao_4.png");
}
else if (iType == Profession_WuShi)
{
item = BaseSprite::create("touxiang_jiaobiao_6.png");
}
if (item)
{
item->setAnchorPoint(ccp(1, 0));
biankuang->addChild(item);
item->setPosition(ccp(biankuang->getContentSize().width, 0));
}
}
//name
HeroFixedPro info = BaseActorPropertyParser::getParser()->getExtraProerty((Profession)mHerosVec[index]->getActorType());
LF::lable(bg, info.nameInChinese,ccp(140, 106),22,fontStr_kaiti)->setTag(TAG_BaseBody_LABLE_NAME);
// 英雄介绍
{
Profession profId = mHerosVec[index]->getActorType();
CCLabelTTF *directionLabel = CCLabelTTF::create(getHeroDirectionByProfessionId(profId).c_str(), fontStr_kaiti, 20, CCSize(380, 0), kCCTextAlignmentLeft);
bg->addChild(directionLabel, 1, Tag_Label_HeroDirection);
directionLabel->setColor(ccc3(165, 125, 76));
directionLabel->setAnchorPoint(ccp(0, 1));
directionLabel->setPosition(ccp(140, 94));
}
if (mFlag == 1)
{
CCMenuItemImage* chose = CCMenuItemImage::create(
"duiwu_yingxiong_weixuanzhong.png"
, "duiwu_yingxiong_weixuanzhong.png"
, this, menu_selector(MainLayerHerosBaseBody::menuItemClicked_choseHero));
chose->setPosition(558, 83);
CCMenu* menu = CCMenu::create(chose, NULL);
menu->setPosition(CCPointZero);
bg->addChild(menu, 0, TAG_Menu);
CCSprite* unlock = CCSprite::create("duiwu_yingxiong_unlock.png", CCRect(0, 0, 610, 129));
//.........这里部分代码省略.........
示例4: getItemContentByIndex
BaseSprite* MainLayerZhuangBeiBaseBody::getItemContentByIndex(unsigned int index)
{
BaseSprite* bg = BaseSprite::create("mianban_zhuangbei_xiangxi.png");
CCString tempStr;
CCPoint picPos = ccp(75.0f, bg->getContentSize().height/2);
{
ImageData diWenData = ImageManager::getManager()->getImageData_DiWen_List(
mEquipmentVec[index]->getEquipColor(),
false,
mEquipmentVec[index]->isPartOfSuit(),
mEquipmentVec[index]->haveZhuanke());
BaseSprite* diWen = BaseSprite::create(diWenData.getCurrentImageFile());
diWen->setScale(diWenData.scale);
diWen->setPosition(picPos);
bg->addChild(diWen,0,TAG_BaseBody_TABLE_ITEM_DiWen);
{
BaseSprite *sprite = ImageManager::getManager()->getSpriteOfZhuangbei(mEquipmentVec[index],true,true);
//sprite->setScale(data.scale);
sprite->setScale(0.43f);
sprite->setPosition(picPos);
bg->addChild(sprite,0,TAG_BaseBody_TABLE_ITEM_Image);
}
//封印
if (mEquipmentVec[index]->isInFengYin())
{
BaseSprite *fyImg = BaseSprite::create("shenbing_fengyin_suo.png");
bg->addChild(fyImg, 0, TAG_BaseBody_TABLE_FengYin_Img);
fyImg->setPosition(diWen->getPosition());
fyImg->setScale(diWen->getContentSize().width*diWen->getScale() / fyImg->getContentSize().width);
}
}
// 添加图片识别区
{
ImageData selecedData = ImageManager::getManager()->getImageData_DiWen_Selected(
mEquipmentVec[index]->getEquipColor(),
false,//mEquipmentVec[index]->isShenBing(),
mEquipmentVec[index]->isPartOfSuit());
BaseSprite* menuItemSel = BaseSprite::create(selecedData.getCurrentImageFile());
menuItemSel->setScale(selecedData.scale);
CCSprite* menuRect = CCSprite::createWithTexture(menuItemSel->getTexture());
menuRect->setScale(0.0f);
FXScrollMenu *menu = FXScrollMenu::create(
mTableView->getParent()->convertToWorldSpace(mTableView->getPosition()), mTableView->getViewSize());
bg->addChild(menu, 0, TAG_BaseBody_MENU);
menu->setPosition(ccp(0,0));
CCMenuItemSprite* t = CCMenuItemSprite::create(menuRect,menuItemSel,this,SEL_MenuHandler(&MainLayerZhuangBeiBaseBody::itemImageClicked));
menu->addChild(t, 0, index);
t->setPosition(picPos);
}
float left_x_start = 160 - 4;
//名称
{
CCLabelTTF* label;
char str[64];
if (mEquipmentVec[index]->getEquipData().qianghua_data.qianghua_count != 0)
{
sprintf(str, "%s", mEquipmentVec[index]->getName().c_str());
}
else
{
sprintf(str, "%s", mEquipmentVec[index]->getName().c_str());
}
label = LF::lable(bg,str,ccp(left_x_start,190),24,fontStr_kaiti);
label->setTag(TAG_BaseBody_LABLE_NAME);
ccColor3B color = ImageManager::getManager()->getShowColor(mEquipmentVec[index]->getEquipColor(),false,mEquipmentVec[index]->isPartOfSuit());
label->setColor(color);
}
//类型
{
std::string typeStr =
CS::getZhuangbeiTypeName(mEquipmentVec[index]->getType(), mEquipmentVec[index]->getEquipColor());
CCLabelTTF* label;
label = LF::lable(bg,typeStr,ccp(left_x_start,165),18,fontStr_kaiti);
label->setTag(TAG_BaseBody_LABLE_TYPE);
label->setColor(fonColor_CiYao);
}
//白字
{
CCLabelTTF* label_baizhi = NULL;
bool hasBaiZhi = false;
{
float baizi = 0;
switch(mEquipmentVec[index]->getType())
{
case ZhuangbeiType_DanshouJian:
case ZhuangbeiType_ShuangshouBishou:
case ZhuangbeiType_ShuangshouFu:
//.........这里部分代码省略.........