本文整理汇总了C++中LayerColor::getPositionX方法的典型用法代码示例。如果您正苦于以下问题:C++ LayerColor::getPositionX方法的具体用法?C++ LayerColor::getPositionX怎么用?C++ LayerColor::getPositionX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayerColor
的用法示例。
在下文中一共展示了LayerColor::getPositionX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tableCellAtIndex
TableViewCell* FriendListScene::tableCellAtIndex(TableView *table, ssize_t idx)
{
int index = idx;
EziFacebookFriend* myFriend = (EziFacebookFriend*)_friendList.at(index);
std::string friendName = myFriend->getName();
//const char* photoPath = myFriend->getPhotoPath().c_str();
bool toRequestForPhoto = false;
if (myFriend->getPhoto() == nullptr)
{
toRequestForPhoto = true;
//EziSocialObject::sharedObject()->getProfilePicForID(this, myFriend->getFBID(), SCALED_VALUE(85.0f), SCALED_VALUE(85.0f), false);
}
// Build the table cell.
TableViewCell *cell = table->cellAtIndex(idx);
if (cell == NULL)
{
cell = new TableViewCell();
cell->autorelease();
LayerColor* colorLayer = LayerColor::create(Color4B(100, 100, 100, 200),
AppDelegate::SCREEN_WIDTH - SCALED_VALUE(20.0f),
SCALED_VALUE(124.0f));
//cell->addChild(colorLayer);
LayerColor* photoLayer = LayerColor::create(Color4B(255, 255, 255, 255),
SCALED_VALUE(100.0f),
SCALED_VALUE(100.0f));
photoLayer->setPosition(SCALED_VALUE(40.0f), SCALED_VALUE(12.0f));
cell->addChild(photoLayer);
Sprite* userPhotoSprite = NULL;
if (toRequestForPhoto)
{
userPhotoSprite = Sprite::create();
userPhotoSprite->setContentSize(Size(SCALED_VALUE(85.0f), SCALED_VALUE(85.0f)));
}
else
{
userPhotoSprite = myFriend->getPhoto(CC_CALLBACK_2(FriendListScene::applyPhoto, this),
false,
SCALED_VALUE(85.0f),
SCALED_VALUE(85.0f));
if (userPhotoSprite == nullptr) { userPhotoSprite = Sprite::create(); }
}
cell->addChild(userPhotoSprite);
userPhotoSprite->setAnchorPoint(Point(0.0f, 0.0));
userPhotoSprite->cocos2d::CCNode::setPosition(SCALED_VALUE(47.0f), SCALED_VALUE(18.0f));
userPhotoSprite->setTag(TAG_PHOTO);
auto message = LabelTTF::create(friendName.c_str(), "Arial", SCALED_VALUE(30.0f));
message->setAnchorPoint(Point(0, 0.5));
message->setPosition(Point(photoLayer->getContentSize().width + photoLayer->getPositionX() + SCALED_VALUE(20.0f),
colorLayer->getContentSize().height/2));
cell->addChild(message);
message->setTag(TAG_MESSAGE);
/*
Sprite* consumedIcon = Sprite::createWithSpriteFrameName("green_tick");
consumedIcon->setAnchorPoint(Point(1.0, 0.5));
cell->addChild(consumedIcon);
consumedIcon->setPosition(Point(colorLayer->getContentSize().width - SCALED_VALUE(20.0f),
colorLayer->getContentSize().height/2));
message->setTag(TAG_CONSUMED_ICON);
MenuItemImage* useButton = MenuItemImage::create();
useButton->setSelectedSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("btn_use_prd"));
useButton->setNormalSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("btn_use_nrl"));
useButton->setAnchorPoint(Point(1.0, 0.5));
useButton->setTarget(this, menu_selector(FriendListScene::useRequest));
Menu* useMenu = Menu::create(useButton, NULL);
cell->addChild(useMenu);
useMenu->setPosition(Point(colorLayer->getContentSize().width - SCALED_VALUE(20.0f),
colorLayer->getContentSize().height/2));
useButton->setTag(index);
useMenu->setTag(TAG_USE_MENU);
*/
}
else
{
Sprite* cellProfilePic = (Sprite*)cell->getChildByTag(TAG_PHOTO);
if (toRequestForPhoto == false)
{
//cellProfilePic->setTexture(Sprite::create(myFriend->getPhotoPath())->getTexture());
Sprite* tempSprite = myFriend->getPhoto();
if (myFriend->getPhoto() != nullptr)
{
cellProfilePic->setTexture(tempSprite->getTexture());
}
//.........这里部分代码省略.........