前端之家收集整理的这篇文章主要介绍了
Cocos2d-x_CCProgressTo(进度计时器类)介绍,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
bool HelloWorld::init()
{
if ( !CCLayer::init() )
{
return false;
}
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCProgressTimer *pross = CCProgressTimer::create(CCSprite::create("Icon-57.png"));
pross->setPosition(ccp(200,170));
pross->setType(kCCProgressTimerTypeRadial); // 设置进度条样式
pross->setPercentage(100); // 设置进度值范围
pross->setReverseProgress(false); // 设置计时方向
CCProgressTo *to1 = CCProgressTo::create(2,100);
this->scheduleUpdate();
pross->runAction(CCRepeatForever::create(to1));
this->addChild(pross);
CCProgressTimer *prossR = CCProgressTimer::create(CCSprite::create("Icon-57.png"));
prossR->setPosition(ccp(310,170));
prossR->setType(kCCProgressTimerTypeBar);
prossR->setMidpoint(ccp(0,1));
prossR->setBarChangeRate(ccp(0,1));
CCProgressTo *to2 = CCProgressTo::create(2,100);
prossR->runAction(CCRepeatForever::create(to2));
this->addChild(prossR);
return true;
}