本文整理汇总了C++中ProgressTimer::setBarChangeRate方法的典型用法代码示例。如果您正苦于以下问题:C++ ProgressTimer::setBarChangeRate方法的具体用法?C++ ProgressTimer::setBarChangeRate怎么用?C++ ProgressTimer::setBarChangeRate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProgressTimer
的用法示例。
在下文中一共展示了ProgressTimer::setBarChangeRate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: progressTimerNodeWithRenderTexture
ProgressTimer* TransitionProgressOutIn::progressTimerNodeWithRenderTexture(RenderTexture* texture)
{
Size size = Director::getInstance()->getWinSize();
ProgressTimer* node = ProgressTimer::create(texture->getSprite());
// but it is flipped upside down so we flip the sprite
node->getSprite()->setFlippedY(true);
node->setType( ProgressTimer::Type::BAR );
node->setMidpoint(Vector2(0.5f, 0.5f));
node->setBarChangeRate(Vector2(1, 1));
node->setPercentage(100);
node->setPosition(Vector2(size.width/2, size.height/2));
node->setAnchorPoint(Vector2(0.5f,0.5f));
return node;
}
示例2: onSkillStarted
void SkillItem::onSkillStarted()
{
this->setEnabled(false);
ProgressTo *to1 = ProgressTo::create(getSkillCDTime(), 100);
ProgressTimer *sprite = ProgressTimer::create(Sprite::create(this->getDisableIcon().c_str()));
sprite->setType(ProgressTimer::Type::RADIAL);
auto tint = Sequence::create(TintTo::create(getSkillCDTime(), 60, 255, 180),
NULL);
sprite->setPosition(Point(getContentSize().width / 2, getContentSize().height / 2));
sprite->setBarChangeRate(Point(0, 1));
addChild(sprite, 0, SKILL_ITEM_CHILD_TAG);
sprite->runAction(Sequence::create(Spawn::create(to1, tint, NULL),CallFunc::create( CC_CALLBACK_0( SkillItem::onSkillCDFinished, this)) ,NULL) );
}
示例3: init
//.........这里部分代码省略.........
auto right_btn = Sprite::create("right.png");
right_btn->setScale(0.3);
right_btn->setPosition(Point(250, 125));
right_btn->setTag(TAG_RIGHT);
this->addChild(right_btn,1);
auto up_btn = Sprite::create("up.png");
up_btn->setScale(0.3);
up_btn->setPosition(Point(175, 200));
up_btn->setTag(TAG_UP);
this->addChild(up_btn,1);
auto down_btn = Sprite::create("down.png");
down_btn->setScale(0.3);
down_btn->setPosition(Point(175, 50));
down_btn->setTag(TAG_DOWN);
this->addChild(down_btn,1);
auto attack_btn = Sprite::create("attack.png");
attack_btn->setScale(0.5);
attack_btn->setPosition(positionForTileCoord(Point(25,16)));
attack_btn->setTag(ATTACK);
this->addChild(attack_btn,1);
//hero hp
Sprite *heroEmHP = Sprite::create("empty.png");
heroEmHP->setPosition(Point(150, 600));
heroEmHP->setScale(1.5);
this->addChild(heroEmHP);
Sprite* heroFuHP = Sprite::create("full.png");
ProgressTimer *pBlood = ProgressTimer::create(heroFuHP);
pBlood->setType(kCCProgressTimerTypeBar);
pBlood->setMidpoint(Point(0, 0));
pBlood->setBarChangeRate(Point(1, 0));
pBlood->setPercentage(100.0f);
pBlood->setPosition(Point(150, 600));
pBlood->setScale(1.5);
this->addChild(pBlood, 1, 6);
auto hero =Sprite::create("hero.png");
hero->setPosition(Point(50, 600));
hero->setScale(0.3);
this->addChild(hero);
//patrol monster hp
Sprite *enEmHP = Sprite::create("empty.png");
enEmHP->setPosition(Point(150, 550));
enEmHP->setScale(1.5);
this->addChild(enEmHP,1,7);
Sprite* enFuHP = Sprite::create("full.png");
ProgressTimer *enpBlood = ProgressTimer::create(enFuHP);
enpBlood->setType(kCCProgressTimerTypeBar);
enpBlood->setMidpoint(Point(0, 0));
enpBlood->setBarChangeRate(Point(1, 0));
enpBlood->setPercentage(100.0f);
enpBlood->setPosition(Point(150, 550));
enpBlood->setScale(1.5);
this->addChild(enpBlood, 1,8);
auto monster = Sprite::create("monster.png");
monster->setPosition(Point(50,550));
monster->setScale(0.1);
monster->setTag(9);
this->addChild(monster);
//archer
Sprite *arEmHP = Sprite::create("empty.png");
arEmHP->setPosition(Point(350, 600));