cocos2d-x中进度条的实现
来源:未知 责任编辑:责任编辑 发表时间:2013-12-01 14:15 点击:次
#include "HelloWorldScene.h"
p>#include "SimpleAudioEngine.h"
p>
p>using namespace cocos2d;
p>using namespace CocosDenshion;
p>
p>CCScene* HelloWorld::scene()
p>{
p>
p> CCScene *scene = CCScene::create();
p> HelloWorld *layer = HelloWorld::create();
p> scene->addChild(layer);
p> return scene;
p>}
p>
p>bool HelloWorld::init()
p>{
p>
p> if ( !CCLayer::init() )
p> {
p> return false;
p> }
p>
p> CCProgressTimer * pross = CCProgressTimer::create(CCSprite::create("Icon.png"));
p> pross->setPosition(ccp(100,180));
p> //设置进度条的样式
p> pross->setType( kCCProgressTimerTypeRadial);
p> //设置进度值范围[0,100]
p> pross->setPercentage(100);
p> //反进度计时
p> pross->setReverseProgress(true);
p> addChild(pross);
p> CCProgressTo *to1 = CCProgressTo::create(2, 100);
p> pross->runAction( CCRepeatForever::create(to1));
p>
p>
p> CCProgressTimer * prossR = CCProgressTimer::create(CCSprite::create("Icon.png"));
p> prossR->setPosition(ccp(210,180));
p> prossR->setType( kCCProgressTimerTypeBar );
p> //设置计时器运动方向
p> prossR->setMidpoint(ccp(0,1));
p> //设置计时器的宽高起始比例
p> prossR->setBarChangeRate(ccp(0, 1));
p>
p>
p> addChild(prossR);
p> CCProgressTo *to2 = CCProgressTo::create(2, 100);
p> prossR->runAction( CCRepeatForever::create(to2));
p>
p>
p> return true;
p>}
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>