天天看點

Cocos2d-x進度條

// 動畫
		CCProgressTo* to1 = CCProgressTo::create(2, 100);
		// 進度條控件
		CCProgressTimer* progress = CCProgressTimer::create(CCSprite::create("f1.png"));
		// 進度條橫向前進的方向是從左至右還是從右至左
		progress->setMidpoint(ccp(0, 1));
		// 進度條樣式
		progress->setType(kCCProgressTimerTypeBar);
		// 進度條按橫向還是縱向增長
		progress->setBarChangeRate(ccp(1, 0));
		progress->setPosition(ccp(progress->getContentSize().width / 2, s.height - progress->getContentSize().height / 2));
		this->addChild(progress);
		progress->runAction(CCRepeatForever::create(to1));