CCProgressTimer的使用
参考文章:http://www.himigame.com/iphone-cocos2d/491.html
进度条样式:
1
2
3
4
5
6
|
kCCProgressTimerTypeRadialCCW,
扇形逆时针形式 kCCProgressTimerTypeRadialCW,
扇形顺时针形式 kCCProgressTimerTypeHorizontalBarLR,
从左往右增张的形式 kCCProgressTimerTypeHorizontalBarRL,
从右往左增张的形式 kCCProgressTimerTypeVerticalBarBT,
从下往上增张的形式 kCCProgressTimerTypeVerticalBarTB,
从上往下增张的形式 |
do { //进度条背景 CCSprite* pLoadingBg = CCSprite::create("gmbg/loading_bg.png"); CCLOG("%s","loading loading_bg.png"); CC_BREAK_IF( !pLoadingBg); pLoadingBg->setPosition(ccp(getWinSize().width/2 + getWinOrigin().x, getWinSize().height/5 + getWinOrigin().y)); this->addChild(pLoadingBg,1); //创建进度条 CCLOG("%s","loading loading.png"); CCSprite* pLoading = CCSprite::create("gmbg/loading.png"); CC_BREAK_IF( !pLoading); CCProgressTimer* pProgressTimer = CCProgressTimer::create(pLoading); //设置进度条的类型 //条形:kCCProgressTimerTypeBar //圆弧:kCCProgressTimerTypeRadial pProgressTimer->setType(CCProgressTimerType::kCCProgressTimerTypeBar); //条形:设置起点,(0,y)表示最左边,(1,y)表示最右边,(x,1)表示最上面,(x,0)表示最下面 //圆弧:设置中心占 pProgressTimer->setMidpoint(ccp(0,0)); //设置进行条进度方向,(1,0)表示横向,(0,1)表示纵向 pProgressTimer->setBarChangeRate(ccp(1,0)); //设置进度条当前的进度,100f表示满值 pProgressTimer->setPercentage(0); //设置进度条的位置 pProgressTimer->setPosition(ccp(getWinSize().width/2 + getWinOrigin().x, getWinSize().height/5 + getWinOrigin().y -5)); this->addChild(pProgressTimer,1,1); return true; } while (false);
posted on 2014-06-21 14:27 linchaolong 阅读(224) 评论(0) 编辑 收藏 举报