本文整理汇总了C++中CCProgressTimer::setType方法的典型用法代码示例。如果您正苦于以下问题:C++ CCProgressTimer::setType方法的具体用法?C++ CCProgressTimer::setType怎么用?C++ CCProgressTimer::setType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCProgressTimer
的用法示例。
在下文中一共展示了CCProgressTimer::setType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onEnter
//------------------------------------------------------------------
//
// SpriteProgressToVertical
//
//------------------------------------------------------------------
void SpriteProgressToVertical::onEnter()
{
SpriteDemo::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCProgressTo *to1 = CCProgressTo::create(2, 100);
CCProgressTo *to2 = CCProgressTo::create(2, 100);
CCProgressTimer *left = CCProgressTimer::create(CCSprite::create(s_pPathSister1));
left->setType(kCCProgressTimerTypeBar);
// Setup for a bar starting from the bottom since the midpoint is 0 for the y
left->setMidpoint(ccp(0,0));
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
left->setBarChangeRate(ccp(0, 1));
addChild(left);
left->setPosition(CCPointMake(100, s.height/2));
left->runAction( CCRepeatForever::create(to1));
CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathSister2));
right->setType(kCCProgressTimerTypeBar);
// Setup for a bar starting from the bottom since the midpoint is 0 for the y
right->setMidpoint(ccp(0, 1));
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
right->setBarChangeRate(ccp(0, 1));
addChild(right);
right->setPosition(CCPointMake(s.width-100, s.height/2));
right->runAction( CCRepeatForever::create(to2));
}
示例2: onEnter
void SpriteProgressToHorizontal::onEnter()
{
SpriteDemo::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCProgressTo *to1 = CCProgressTo::create(2, 100);
CCProgressTo *to2 = CCProgressTo::create(2, 100);
CCProgressTimer *left = CCProgressTimer::progressWithFile(s_pPathSister1);
left->setType(kCCProgressTimerTypeHorizontalBarLR);
// Setup for a bar starting from the left since the midpoint is 0 for the x
left->setMidpoint(ccp(0,0));
// Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
left->setBarChangeRate(ccp(1, 0));
addChild(left);
left->setPosition(ccp(100, s.height/2));
left->runAction( CCRepeatForever::create(to1));
CCProgressTimer *right = CCProgressTimer::progressWithFile(s_pPathSister2);
right->setType(kCCProgressTimerTypeHorizontalBarRL);
// Setup for a bar starting from the left since the midpoint is 1 for the x
right->setMidpoint(ccp(1, 0));
// Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
right->setBarChangeRate(ccp(1, 0));
addChild(right);
right->setPosition(ccp(s.width-100, s.height/2));
right->runAction( CCRepeatForever::create(to2));
}
示例3: energyBarAnimation
void ASGame::energyBarAnimation(){
//1.显示行动力的圆形底座
CCSprite* energyBall = CCSprite::createWithSpriteFrameName("newEnergyContainer.png");
energyBall->setPosition(ccp(size.width*17.38/80,size.height*77.85/90+winDif*2*alpha*alpha));
addChild(energyBall,4);
//2.行动力数量
string perStr = int2string(moveCount);
CCLabelTTF* per = CCLabelTTF::create(perStr.c_str(),"Arial Rounded MT bold",32);
per->setPosition(ccp(size.width*17.38/80,size.height*77.85/90+winDif*2*alpha*alpha));
addChild(per,5,1*10000000+26);
//3.能量条
CCSprite* energyBarSprite = CCSprite::createWithSpriteFrameName("newEnergyBar.png");
CCProgressTimer* energyBar = CCProgressTimer::create(energyBarSprite);
energyBar->setPosition(ccp(size.width*8.45/80,size.height*79.89/90+winDif*2*alpha*alpha));
energyBar->setType(kCCProgressTimerTypeRadial);
energyBar->setPercentage(moveCount*20);
addChild(energyBar,4,1*10000000+20);
//4.攻击按钮底座
CCSprite* containerSprite = CCSprite::createWithSpriteFrameName("energyContainer.png");
CCSprite* containerSprite_s = CCSprite::createWithSpriteFrameName("energyContainer.png");
CCMenuItemSprite* energyContainer = CCMenuItemSprite::create(containerSprite,containerSprite_s,this,menu_selector(ASGame::enterFightLayer));
energyContainer->setScale(1.05);
energyContainer->setPosition(ccp(size.width*179.5/200,size.height*10.25/135));
CCMenu* energyContainerMenu = CCMenu::create(energyContainer,NULL);
energyContainerMenu->setPosition(CCPointZero);
if (moveCount < moveToFight)
energyContainerMenu->setTouchEnabled(false);
addChild(energyContainerMenu,2,1*10000000+27);
//5.攻击按钮充值槽
CCSprite* barSprite = CCSprite::createWithSpriteFrameName("energyBar.png");
CCProgressTimer* attackButton = CCProgressTimer::create(barSprite);
attackButton->setScale(1.05);
attackButton->setPosition(ccp(size.width*179.04/200,size.height*10/135));
attackButton->setType(kCCProgressTimerTypeBar);
attackButton->setMidpoint(ccp(0.5, 0));
attackButton->setBarChangeRate(ccp(0, 1));
attackButton->setPercentage(100*moveCount/moveToFight);
addChild(attackButton,3,1*10000000+25);
//4.能量的盖子
CCSprite* energyBarCover = CCSprite::createWithSpriteFrameName("energyBarCover.png");
energyBarCover->setPosition(ccp(size.width*179.5/200,size.height*10.25/135));
energyBarCover->setOpacity(0);
//addChild(energyBarCover,4,1*10000000+28);
}
示例4: skillDecCD
//******************************************************************************
// skillDecCD
//******************************************************************************
void Card::skillDecCD(int cd)
{
CCSprite* spWhite = CCSprite::spriteWithFile("headw.png");
if (spWhite) {
addChild(spWhite, 2, kToBeDeleteTag);
spWhite->setPositionInPixels(CCPointMake(55 + 106*m_idx, 615));
spWhite->setIsVisible(false);
spWhite->runAction(CCSequence::actions(CCDelayTime::actionWithDuration(0.7),
CCShow::action(),
CCFadeIn::actionWithDuration(0.15),
CCFadeOut::actionWithDuration(0.15),
CCCallFunc::actionWithTarget(this, callfunc_selector(Card::delUnusedObj)),
NULL));
CCProgressTimer* tmOrange = CCProgressTimer::progressWithFile("heado.png");
if (tmOrange) {
addChild(tmOrange, 2, kToBeDeleteTag);
tmOrange->setPositionInPixels(CCPointMake(55 + 106*m_idx, 615));
tmOrange->setType(kCCProgressTimerTypeRadialCCW);
tmOrange->setPercentage(99);
tmOrange->runAction(CCProgressTo::actionWithDuration(0.7, 0));
}
}
m_iSklCdDwn = cd;
m_iCurSkillCD = MIN(m_iCurSkillCD.get(), (m_iSkillCDMax - m_iSklCdDwn));
}
示例5: setUpdateView
bool wootestScene::setUpdateView()
{
bool isRet=false;
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
do
{
// 进度条背景
CCSprite* loadbackimg=CCSprite::create("lodingbg.png");
CC_BREAK_IF(!loadbackimg);
loadbackimg->setPosition(ccp(visibleSize.width/2+origin.x,visibleSize.height/5+origin.y));
this->addChild(loadbackimg,2);
// 进度条
CCSprite* loadimg=CCSprite::create("longding.png");
CC_BREAK_IF(!loadimg);
CCProgressTimer* pt = CCProgressTimer::create(loadimg);
pt->setType(kCCProgressTimerTypeBar);// 设置成横向
pt->setMidpoint(ccp(0,0));
// 设置进度条从左到右
pt->setBarChangeRate(ccp(1,0));
//重新设置锚点
float tex=visibleSize.width/2+origin.x;
float tey=visibleSize.height/5+origin.y-5;
pt->setPosition(ccp(tex,tey));
pt->setPercentage(0);
this->addChild(pt,2,1);
isRet=true;
} while (0);
return isRet;
}
示例6: makeSkillCD
void ControllPanel::makeSkillCD(CCObject *pSender)
{
CCLog("makeSkillCD");
//进入CD状态
this->setMagicCD(true);
//设置按钮不可用
m_pMagicItem->setIsEnabled(false);
//创建技能cd样式
CCProgressTimer *cd = CCProgressTimer::progressWithFile("actor_btn_mask.png");
cd->setType(kCCProgressTimerTypeRadialCCW);
cd->setPosition(m_pMagicItem->getParent()->getPosition());
cd->setPercentage(99.99f);
this->addChild(cd, 1000);
//技能冷却动画
CCProgressTo *to = CCProgressTo::actionWithDuration(PlayerMrg::getInstance()->getPlayer()->getPlayerSkillCd(), 0);
//冷却完成之后的回调,销毁对象,同时使技能按钮可用
CCCallFuncND *callfunn = CCCallFuncND::actionWithTarget(this, callfuncND_selector(ControllPanel::endSkillCD), (void*)cd);
cd->runAction(CCSequence::actions(to, callfunn, NULL));
m_lMagicCDLabel->setIsVisible(true);
schedule(schedule_selector(ControllPanel::updateCountDown), 1.0f);
}
示例7: setUpdateView
bool LoadingLayer::setUpdateView()
{
bool isRet = false;
do{
CCSprite* loadingbackimg = CCSprite::create("gmbg/loadingbg.png");
CC_BREAK_IF(!loadingbackimg);
loadingbackimg->setPosition(ccp(getWinSize().width/2 + getWinOrigin().x, getWinSize().height/5 + getWinOrigin().y));
this->addChild(loadingbackimg, 1);
CCSprite* loadimg = CCSprite::create("gmbg/loading.png");
CC_BREAK_IF(!loadimg);
CCProgressTimer* pt = CCProgressTimer::create(loadimg);
pt->setType(cocos2d::CCProgressTimerType(kCCProgressTimerTypeBar));
pt->setMidpoint(ccp(0,0.5));
pt->setBarChangeRate(ccp(1,0));
float tex = getWinSize().width/2 + getWinOrigin().x;
float tey = getWinSize().height/5 + getWinOrigin().y-5;
pt->setPosition(ccp(tex, tey));
pt->setPercentage(0);
this->addChild(pt, 2, 1);
CCProgressTo* to = CCProgressTo::create(5, 100);
pt->runAction(CCRepeatForever::create(to));
isRet = true;
}while(0);
return isRet;
}
示例8: init
bool HSShowEndurance::init()
{
for (int i=0; i<HSShowEndurance::S_C_ENDURANCE_COUNT; ++i)
{
CCString* pPanel = CCString::createWithFormat("UI_Benfangxinxiban_Naili_%d",i);
HSCCSprite* pSprite = HS_FIND_UI_PANEL_SPRITE(pPanel->getCString(),"Naili_1");
pSprite->setVisible(false);
CCProgressTimer* pProgress = CCProgressTimer::create(pSprite);
pProgress->setType(kCCProgressTimerTypeBar);
pProgress->setPosition(pSprite->getPosition());
pProgress->setMidpoint(ccp(0.5,0));
pProgress->setBarChangeRate(ccp(0,1));
i < HSShowEndurance::S_CURRENT_ENDURANCE_COUNT ? pProgress->setPercentage(100) : pProgress->setPercentage(0);
pSprite->getParent()->addChild(pProgress,2000);
m_enduranceMap.insert(pair<int, CCProgressTimer*>(i + 1,pProgress));
CC_SAFE_RELEASE_NULL(pPanel);
}
HSCCSprite* pSprite = HS_FIND_UI_PANEL_SPRITE("UI_Benfangxinxiban_Nailijishiqi","Pipeinailidiban");
m_pMaxLabel = CCLabelTTF::create("MAX", HS_FONT_HuaKang, 25, pSprite->getContentSize(), kCCTextAlignmentCenter,kCCVerticalTextAlignmentCenter);
m_pMaxLabel->setAnchorPoint(HS_ANCHOR_CENTER);
m_pMaxLabel->setPosition(pSprite->getAnchorPointInPoints());
m_pMaxLabel->setVisible(false);
pSprite->addChild(m_pMaxLabel);
this->CreateTimeLabel();
this->schedule(schedule_selector(HSShowEndurance::Updata));
return true;
}
示例9: setUpdateView
bool LoadingLayer::setUpdateView(){
bool isRet=false;
do
{
// 设置进度条的背景图片 我们把他放到屏幕下方的1/5处
CCSprite* loadbackimg=CCSprite::create("gmbg/lodingbg.png");
CC_BREAK_IF(!loadbackimg);
loadbackimg->setPosition(ccp(getWinSize().width/2+getWinOrigin().x,getWinSize().height/5+getWinOrigin().y));
this->addChild(loadbackimg,1);
// 添加进度条
CCSprite* loadimg=CCSprite::create("gmbg/longding.png");
CC_BREAK_IF(!loadimg);
CCProgressTimer* pt = CCProgressTimer::create(loadimg);
pt->setType(kCCProgressTimerTypeBar);// 设置成横向的
//可以看作是按矩形显示效果的进度条类型
pt->setMidpoint(ccp(0,0));
// 用来设定进度条横向前进的方向从左向右或是从右向左
pt->setBarChangeRate(ccp(1,0));
//重新设置锚点
float tex=getWinSize().width/2+getWinOrigin().x;
float tey=getWinSize().height/5+getWinOrigin().y-5;
pt->setPosition(ccp(tex,tey));
pt->setPercentage(0);
this->addChild(pt,2,1);
isRet=true;
} while (0);
return isRet;
}
示例10: createProgressTimer
CCProgressTimer* createProgressTimer(CCSprite* sprite)
{
CCProgressTimer *progress = CCProgressTimer::create(sprite);
progress->setType( kCCProgressTimerTypeBar );
progress->setMidpoint(ccp(0,0));
progress->setBarChangeRate(ccp(1, 0));
return progress;
}
示例11: createRedStartPrompt
CCProgressTimer* SectionGuide::createRedStartPrompt()
{
CCSprite* sprite = CCSprite::create(ResManager::getManager()->getSharedFilePath("circle.png").c_str());
CCProgressTimer *progress = CCProgressTimer::create(sprite);
progress->setType( kCCProgressTimerTypeRadial );
progress->setVisible(false);
return progress;
}
示例12: createRedStartToTableArrows
CCProgressTimer* SectionGuide::createRedStartToTableArrows()
{
CCSprite* sprite = CCSprite::create(ResManager::getManager()->getSharedFilePath("arrows.png").c_str());
CCProgressTimer *progress = CCProgressTimer::create(sprite);
progress->setType( kCCProgressTimerTypeBar );
progress->setVisible(false);
progress->setMidpoint(ccp(0,1));
progress->setBarChangeRate(ccp(0, 1));
return progress;
}
示例13: JDCallback
//进度动作
void HelloWorld::JDCallback(CCObject* pSender)
{
CCProgressTo *to1 = CCProgressTo::actionWithDuration(2,100);
CCSprite *jl=CCSprite::spriteWithFile("jl.png");
CCProgressTimer *left = CCProgressTimer::progressWithSprite(jl);
left->setType(kCCProgressTimerTypeBar);
addChild(left);
left->setPosition(CCPointMake(100,s.height/2));
left->runAction(CCRepeatForever::actionWithAction(to1));
}
示例14: onEnter
//------------------------------------------------------------------
//
// SpriteProgressToVertical
//
//------------------------------------------------------------------
void SpriteProgressToVertical::onEnter()
{
SpriteDemo::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCProgressTo *to1 = CCProgressTo::actionWithDuration(2, 100);
CCProgressTo *to2 = CCProgressTo::actionWithDuration(2, 100);
CCProgressTimer *left = CCProgressTimer::progressWithFile(s_pPathSister1);
left->setType( kCCProgressTimerTypeVerticalBarBT );
addChild(left);
left->setPosition(CCPointMake(100, s.height/2));
left->runAction( CCRepeatForever::actionWithAction(to1));
CCProgressTimer *right = CCProgressTimer::progressWithFile(s_pPathSister2);
right->setType( kCCProgressTimerTypeVerticalBarTB );
addChild(right);
right->setPosition(CCPointMake(s.width-100, s.height/2));
right->runAction( CCRepeatForever::actionWithAction(to2));
}
示例15: onEnter
void CCTransitionRadialCCW::onEnter()
{
CCTransitionScene::onEnter();
// create a transparent color layer
// in which we are going to add our rendertextures
CCSize size = CCDirector::sharedDirector()->getWinSize();
// create the second render texture for outScene
m_OutRT = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);
if (NULL == m_OutRT)
return;
m_OutRT->retain();
m_OutRT->getSprite()->setAnchorPoint(ccp(0.5f,0.5f));
m_OutRT->setPosition(ccp(size.width/2, size.height/2));
m_OutRT->setAnchorPoint(ccp(0.5f,0.5f));
// We need the texture in RenderTexture.
CCProgressTimer *outNode = CCProgressTimer::progressWithTexture(m_OutRT->getSprite()->getTexture());
// but it's flipped upside down so we flip the sprite
outNode->getSprite()->setFlipY(true);
// fix content scale factor for radial texture
CCRect rect = CCRectZero;
rect.size = m_OutRT->getSprite()->getTexture()->getContentSize();
outNode->getSprite()->setTextureRect(rect, false);
float scale = 1.0f / CC_CONTENT_SCALE_FACTOR();
rect.size.width *= scale;
rect.size.height *= scale;
outNode->setContentSize(rect.size);
// Return the radial type that we want to use
outNode->setType(radialType());
outNode->setPercentage(100.f);
outNode->setPosition(ccp(size.width/2, size.height/2));
outNode->setAnchorPoint(ccp(0.5f,0.5f));
// create the blend action
CCAction * layerAction = CCSequence::actions
(
CCProgressFromTo::actionWithDuration(m_fDuration, 100.0f, 0.0f),
CCEventCall::actionWithTarget(NULL, createEventHandler(this, &CCTransitionScene::_finish)),
NULL
);
// run the blend action
outNode->runAction(layerAction);
// add the layer (which contains our two rendertextures) to the scene
this->addChild(outNode, 2, kSceneRadial);
}