void HelloWorld::update(float delta);
int _count = 0;
Size size = Director::getInstance()->getVisibleSize();
cocos2d::ui::LoadingBar* loadingBar = cocos2d::ui::LoadingBar::create("sliderProgress.png");
loadingBar->setTag(10);
loadingBar->setPosition(Vec2(size.width/2,size.height/2 +loadingBar->getContentSize().height / 4.0f));
loadingBar->setDirection(cocos2d::ui::LoadingBar::Direction::RIGHT);
this->addChild(loadingBar);
this->schedule(schedule_selector(HelloWorld::update),2);//每2秒执行一次update也可以定义其他函数
void HelloWorld::update(float delta){
CCLOG("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX %d");
log("--------->%d",_count);
_count++;
if (_count == 100)
{
_count = 0;
}
cocos2d::ui::LoadingBar* loadingBar = static_cast<cocos2d::ui::LoadingBar*>(this->getChildByTag(10));
loadingBar->setPercent(_count);
}