本文整理汇总了C++中Member::addChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Member::addChild方法的具体用法?C++ Member::addChild怎么用?C++ Member::addChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Member
的用法示例。
在下文中一共展示了Member::addChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool JoinMembers::init()
{
CCLayer::init();
this->setTouchEnabled(true);
schedule(schedule_selector(JoinMembers::update));
goalPoint = ccp(240, 160);
Member* findingUser = new Member();
findingUser->initWithFile("search_finding.png");
findingUser->autorelease();
findingUser->setPosition(ccp(240, 225 + 20.f));
findingUser->goalPoint = findingUser->getPosition();
findingUser->startPoint = findingUser->getPosition();
findingUser->runAction(CCRepeatForever::create(CCSequence::createWithTwoActions(CCFadeOut::create(1.f),
CCFadeIn
::create(1.f))));
// findingUser->isGoal = true;
addChild(findingUser);
members.push_back(findingUser);
allUser = new Member();
allUser->initWithFile("search_user.png");
allUser->setPosition(ccp(240, 176 + 20.f));
allUser->goalPoint = allUser->getPosition();
allUser->startPoint = allUser->getPosition();
addChild(allUser);
// allUser->isGoal = true;
members.push_back(allUser);
Member* me = new Member();
me->initWithFile("search_me.png");
me->autorelease();
// me->setScale(2.f);
// me->isGoal = true;
me->setPosition(ccp(240, 145 + 20.f));
me->goalPoint = me->getPosition();
me->startPoint = me->getPosition();
addChild(me);
members.push_back(me);
CCSprite* flag = CCSprite::createWithSpriteFrameName((NSDefault::getCountry() + ".png").c_str());
flag->setPosition(ccp(28, 22));
me->addChild(flag);
CCLabelTTF* userName = CCLabelTTF::create(NSDefault::getUserName().c_str(), defaultFont, 13.f);
userName->setColor(ccc3(0,0,0));
me->addChild(userName);
userName->setAnchorPoint(ccp(0.f, 0.5f));
userName->setPosition(ccp(55, 21));
Member* progressBack = new Member();
progressBack->initWithFile("search_back.png");
progressBack->autorelease();
progressBack->setPosition(ccp(240, 202 + 20.f));
progressBack->startPoint = progressBack->goalPoint = progressBack->getPosition();
addChild(progressBack);
members.push_back(progressBack);
progress = CCProgressTimer::create(CCSprite::create("search_front.png"));
progress->setBarChangeRate(ccp(1, 0));
progress->setMidpoint(ccp(0, 0.5f));
progress->setType(CCProgressTimerType::kCCProgressTimerTypeBar);
progress->setPosition(ccp(240, 202 + 20.f));
progress->setPercentage(0.f);
addChild(progress);
return true;
}