本文整理汇总了C++中CCProgressTimer::getSprite方法的典型用法代码示例。如果您正苦于以下问题:C++ CCProgressTimer::getSprite方法的具体用法?C++ CCProgressTimer::getSprite怎么用?C++ CCProgressTimer::getSprite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCProgressTimer
的用法示例。
在下文中一共展示了CCProgressTimer::getSprite方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: changeHeart
void ASGame::changeHeart(int _shengming,int _source){
shengming += _shengming;
if (shengming<=0)
shengming = 0;
//1.血条
CCProgressTimer* heartBar = (CCProgressTimer*)this->getChildByTag(1*10000000+2222);
CCProgressFromTo* action = CCProgressFromTo::create(0.5, heartBar->getPercentage(), (float)shengming/(float)maxShengMing*100);
heartBar->runAction(action);
if ((float)shengming <= 0.4*(float)maxShengMing){
heartBar->getSprite()->setColor(ccc3(237, 45, 37));
if(!MainUser->muted){
CocosDenshion::SimpleAudioEngine::sharedEngine()->stopEffect(heartSoundEffect);
heartSoundEffect = CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("noHeart.wav", true);
}
}else{
heartBar->getSprite()->setColor(ccc3(255, 255, 255));
if(!MainUser->muted)
CocosDenshion::SimpleAudioEngine::sharedEngine()->stopEffect(heartSoundEffect);
}
//2.生命数字
string HeartStr = int2string(shengming) + "/" + int2string(maxShengMing);
CCLabelTTF* heartLabel = (CCLabelTTF*)this->getChildByTag(playerNumber*10000000+2223);
heartLabel->setString(HeartStr.c_str());
//3.判断胜利条件
if (shengming == 0 && !((GameBaseClass*)getParent())->gameover){
((GameBaseClass*)getParent())->gameover = true;
//1.禁用各种按钮
CCMenu* skillMenu = (CCMenu*)this->getChildByTag(1*10000000+27);
CCMenu* optionMenu = (CCMenu*)this->getChildByTag(1*10000000+12);
CCMenu* itemMenu = (CCMenu*)this->getChildByTag(1*10000000+77776);
skillMenu->setTouchEnabled(false);
optionMenu->setTouchEnabled(false);
itemMenu->setTouchEnabled(false);
//2.停止所有监听
unscheduleAllSelectors();
bot2->unscheduleAllSelectors();
//3.结束页面
((GameBaseClass*)getParent())->GameResult(1);
}
}
示例3: 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
CCRenderTexture *outTexture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);
if (NULL == outTexture)
{
return;
}
outTexture->getSprite()->setAnchorPoint(ccp(0.5f,0.5f));
outTexture->setPosition(ccp(size.width/2, size.height/2));
outTexture->setAnchorPoint(ccp(0.5f,0.5f));
// render outScene to its texturebuffer
outTexture->clear(0,0,0,1);
outTexture->begin();
m_pOutScene->visit();
outTexture->end();
// Since we've passed the outScene to the texture we don't need it.
this->hideOutShowIn();
// We need the texture in RenderTexture.
CCProgressTimer *outNode = CCProgressTimer::progressWithTexture(outTexture->getSprite()->getTexture());
// but it's flipped upside down so we flip the sprite
outNode->getSprite()->setFlipY(true);
// 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),
CCCallFunc::actionWithTarget(this, callfunc_selector(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);
}
示例4: progressTimerNodeWithRenderTexture
CCProgressTimer* CCTransitionProgressRadialCW::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCProgressTimer* pNode = CCProgressTimer::create(texture->getSprite());
// but it is flipped upside down so we flip the sprite
pNode->getSprite()->setFlipY(true);
pNode->setType( kCCProgressTimerTypeRadial );
// Return the radial type that we want to use
pNode->setReverseDirection(true);
pNode->setPercentage(100);
pNode->setCenterOrigin(ccp(size.width/2, size.height/2));
return pNode;
}