本文整理汇总了C++中ProgressTimer类的典型用法代码示例。如果您正苦于以下问题:C++ ProgressTimer类的具体用法?C++ ProgressTimer怎么用?C++ ProgressTimer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProgressTimer类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: angryChange
void BattleFieldUI::angryChange(Actor* angry)
{//show the effect when angry change
auto percent = angry->getAngry() / angry->getAngryMax() * 100;
auto progressTo = ProgressTo::create(0.3, percent);
auto progressToClone = ProgressTo::create(1, percent + 2);
ProgressTimer* bar;
if (angry->getname() == KnightValues._name)
{
bar = KnightAngry;
if (percent >= 100)
KnightAngryFullSignal->setVisible(true);
else if (percent == 0)
KnightAngryFullSignal->setVisible(false);
}
else if (angry->getname() == ArcherValues._name)
{
bar = ArcherAngry;
if (percent >= 100)
ArcherAngryFullSignal->setVisible(true);
else if (percent == 0)
ArcherAngryFullSignal->setVisible(false);
}
else if (angry->getname() == MageValues._name)
{
bar = MageAngry;
if (percent >= 100)
MageAngryFullSignal->setVisible(true);
else if (percent == 0)
MageAngryFullSignal->setVisible(false);
}
bar->runAction(progressTo);
}
示例2: ProgressTimer
ProgressTimer* ProgressTimer::create(Sprite* sp)
{
ProgressTimer *pProgressTimer = new ProgressTimer();
if (pProgressTimer->initWithSprite(sp))
{
pProgressTimer->autorelease();
}
else
{
delete pProgressTimer;
pProgressTimer = NULL;
}
return pProgressTimer;
}
示例3: ProgressTimer
ProgressTimer* ProgressTimer::create(Sprite* sp)
{
ProgressTimer *progressTimer = new ProgressTimer();
if (progressTimer->initWithSprite(sp))
{
progressTimer->autorelease();
}
else
{
delete progressTimer;
progressTimer = nullptr;
}
return progressTimer;
}
示例4: new
ProgressTimer* ProgressTimer::create(Sprite* sp)
{
sp->setCascadeOpacityEnabled(true);
ProgressTimer *progressTimer = new (std::nothrow) ProgressTimer();
if (progressTimer->initWithSprite(sp))
{
progressTimer->autorelease();
progressTimer->setCascadeOpacityEnabled(true);
}
else
{
delete progressTimer;
progressTimer = nullptr;
}
return progressTimer;
}
示例5: 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) );
}
示例6: setupTransition
// TransitionProgress
void TransitionProgress::onEnter()
{
TransitionScene::onEnter();
setupTransition();
// create a transparent color layer
// in which we are going to add our rendertextures
Size size = Director::getInstance()->getWinSize();
// create the second render texture for outScene
RenderTexture *texture = RenderTexture::create((int)size.width, (int)size.height);
texture->getSprite()->setAnchorPoint(Vector2(0.5f,0.5f));
texture->setPosition(Vector2(size.width/2, size.height/2));
texture->setAnchorPoint(Vector2(0.5f,0.5f));
// render outScene to its texturebuffer
texture->beginWithClear(0, 0, 0, 1);
_sceneToBeModified->visit();
texture->end();
// Since we've passed the outScene to the texture we don't need it.
if (_sceneToBeModified == _outScene)
{
hideOutShowIn();
}
// We need the texture in RenderTexture.
ProgressTimer *node = progressTimerNodeWithRenderTexture(texture);
// create the blend action
ActionInterval* layerAction = (ActionInterval*)Sequence::create(
ProgressFromTo::create(_duration, _from, _to),
CallFunc::create(CC_CALLBACK_0(TransitionScene::finish,this)),
nullptr);
// run the blend action
node->runAction(layerAction);
// add the layer (which contains our two rendertextures) to the scene
addChild(node, 2, kSceneRadial);
}
示例7: size_t
void Histogram1DDataBlock::ComputeTemplate(const TOCBlock* source,
uint64_t iLevel) {
// compute histogram by iterating over all bricks of the given level
UINT64VECTOR3 bricksInSourceLevel = source->GetBrickCount(iLevel);
size_t iCompcount = size_t(source->GetComponentCount());
T* pTempBrickData = new T[size_t(source->GetMaxBrickSize().volume())
*iCompcount];
uint32_t iOverlap =source->GetOverlap();
ProgressTimer timer;
timer.Start();
for (uint64_t bz = 0;bz<bricksInSourceLevel.z;bz++) {
for (uint64_t by = 0;by<bricksInSourceLevel.y;by++) {
for (uint64_t bx = 0;bx<bricksInSourceLevel.x;bx++) {
UINT64VECTOR4 brickCoords(bx,by,bz,iLevel);
source->GetData((uint8_t*)pTempBrickData, brickCoords);
UINTVECTOR3 bricksize = UINTVECTOR3(source->GetBrickSize(brickCoords));
for (uint32_t z = iOverlap;z<bricksize.z-iOverlap;z++) {
for (uint32_t y = iOverlap;y<bricksize.y-iOverlap;y++) {
for (uint32_t x = iOverlap;x<bricksize.x-iOverlap;x++) {
// TODO: think about what todo with multi component data
// right now we only pick the first component
size_t val = size_t(pTempBrickData[iCompcount*(x+y*bricksize.x+z*bricksize.x*bricksize.y)]);
m_vHistData[val]++;
}
}
}
}
}
float progress = float(bz)/float(bricksInSourceLevel.z);
MESSAGE("Computing 1D Histogram %5.2f%% (%s)",
progress * 100.0f,
timer.GetProgressMessage(progress).c_str());
}
delete [] pTempBrickData;
}
示例8: init
bool skillCd::init()
{
if (!Layer::init())
return false;
Size visibleSize = Director::getInstance()->getVisibleSize();
ProgressTo *to = ProgressTo::create(3.0f, 100);
Sprite *skill_icon = Sprite::create("icon.png");
ProgressTimer *skill = ProgressTimer::create(skill_icon);
skill->setType(kCCProgressTimerTypeRadial);
skill->setPosition(visibleSize.width / 2, visibleSize.height / 2);
addChild(skill);
Sprite *skill_icon_back = skill_icon;
skill_icon_back->setPosition(visibleSize.width / 2, visibleSize.height / 2);
skill_icon_back->setOpacity(100);
addChild(skill_icon_back);
skill->runAction(to);
return true;
}
示例9: cool
void SkillButton::cool(float time) {
ProgressTimer *prog = static_cast<ProgressTimer *>(this->getChildByTag(PROGRESS_TAG));
//判断之前是否已经设置了冷却效�?
if (!prog) {
prog = ProgressTimer::create(Sprite::create("image/1.png"));
prog->setType( ProgressTimer::Type::RADIAL);
prog->setTag(PROGRESS_TAG);
this->addChild(prog);
prog->setAnchorPoint(Vec2(0.f, 0.f));
prog->setPosition(0.f, 0.f);
prog->setScale(this->getContentSize().width / prog->getContentSize().width); //调整到和图标一样大�?
}
auto to1 = Sequence::createWithTwoActions(ProgressTo::create(0, 100.f),
ProgressTo::create(time, 0.f));
prog->runAction(to1);
}
示例10: 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;
}
示例11: CCASSERT
//.........这里部分代码省略.........
left_btn->setTag(TAG_LEFT);
this->addChild(left_btn,1);
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);
示例12: newAABB
void GameScene::addTouchListener()
{
auto touchListener = EventListenerTouchOneByOne::create();
touchListener->onTouchBegan = [this](Touch* t,Event* e)->bool{
auto menuCoo = menu->convertToNodeSpace(t->getLocation());
Rect oldAABB = buttonCoco->getBoundingBox();
Vec2 oldVec = oldAABB.origin;
Vec2 newVec = oldVec-buttonCoco->getContentSize()/2;
Rect newAABB(newVec.x,newVec.y,oldAABB.size.width,oldAABB.size.height);
if(mpProgressTimer->getPercentage()==100.0f&&newAABB.containsPoint(menuCoo)){
isMagic = true;
coco->playAnimation(BaseSprite::State::magic);
if(!eff){
eff = EffSprite::create("pfca/effect/eff_point_Coco_ult.fca", "effect/eff_point_Coco_ult");
this->addChild(eff);
}
eff->setVisible(true);
eff->setPosition(0-_director->getWinSize().width/2,0);
eff->playAnimation(BaseSprite::State::magic,CallFunc::create(CC_CALLBACK_0(GameScene::effectCallback, this)));
mpProgressTimer->setPercentage(0.f);
}
return true;
};
auto hurtLisener = EventListenerCustom::create("hurt", [this](EventCustom* e)->void{
auto hurtObject = (BaseSprite*)e->getUserData();
Label* l = nullptr;
ProgressTimer* hp = nullptr;
if(hurtObject==boss){
l = l1;
hp = effectHpProgressTimer[0];
}else{
l = l2;
hp = effectHpProgressTimer[1];
}
if(dynamic_cast<TreeBoss*>(hurtObject)){
l->setPosition(hurtObject->getPosition()+Vec2(_director->getWinSize().width/2,_director->getWinSize().height/2+200));
hp->setPosition(hurtObject->getPosition()+Vec2(_director->getWinSize().width/2,_director->getWinSize().height/2+180));
}
else{
l->setPosition(hurtObject->getPosition()+Vec2(_director->getWinSize().width/2,_director->getWinSize().height/2+100));
hp->setPosition(hurtObject->getPosition()+Vec2(_director->getWinSize().width/2,_director->getWinSize().height/2+130));
}
hp->setPercentage((hurtObject->getProperty().curLife/hurtObject->getProperty().maxLife)*100);
l->setString("-"+Value((int)hurtObject->getCurHurt()).asString());
if(!l->getParent()){
this->addChild(l,3);
}
if(!hp->getParent()){
this->addChild(hp,3);
}
hp->setVisible(true);
if(!l->isVisible()){
l->setVisible(true);
l->setOpacity(255);
}
auto move = MoveBy::create(0.5f, Vec2(0,20));
auto fade = FadeOut::create(0.5f);
l->runAction(Sequence::create(move, fade,CallFunc::create(std::bind(&GameScene::lableCallback, this,l)),nullptr));
hp->runAction(Sequence::create(DelayTime::create(1.0f),CallFuncN::create([](Node* n){
n->setVisible(false);
}), NULL));
});
_eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener,buttonCoco);
_eventDispatcher->addEventListenerWithSceneGraphPriority(hurtLisener,this);
}