本文整理汇总了C++中CCProgressTimer::setContentSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CCProgressTimer::setContentSize方法的具体用法?C++ CCProgressTimer::setContentSize怎么用?C++ CCProgressTimer::setContentSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCProgressTimer
的用法示例。
在下文中一共展示了CCProgressTimer::setContentSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}