// CCTransitionProgress void CCTransitionProgress::onEnter() { CCTransitionScene::onEnter(); setupTransition(); // 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 *texture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height); texture->getSprite()->setAnchorPoint(ccp(0.5f,0.5f)); texture->setPosition(ccp(size.width/2, size.height/2)); texture->setAnchorPoint(ccp(0.5f,0.5f)); // render outScene to its texturebuffer texture->clear(0, 0, 0, 1); texture->begin(); m_pSceneToBeModified->visit(); texture->end(); // Since we've passed the outScene to the texture we don't need it. if (m_pSceneToBeModified == m_pOutScene) { hideOutShowIn(); } // We need the texture in RenderTexture. CCProgressTimer *pNode = progressTimerNodeWithRenderTexture(texture); // create the blend action CCActionInterval* layerAction = (CCActionInterval*)CCSequence::create( CCProgressFromTo::create(m_fDuration, m_fFrom, m_fTo), CCCallFunc::create(this, callfunc_selector(CCTransitionProgress::finish)), NULL); // run the blend action pNode->runAction(layerAction); // add the layer (which contains our two rendertextures) to the scene addChild(pNode, 2, kCCSceneRadial); }
// TransitionProgress void TransitionProgress::onEnter() { TransitionScene::onEnter(); setupTransition(); // create a transparent color layer // in which we are going to add our rendertextures Size size = Director::getInstance()->getWinSize(); // create the second render texture for outScene RenderTexture *texture = RenderTexture::create((int)size.width, (int)size.height); texture->getSprite()->setAnchorPoint(Vector2(0.5f,0.5f)); texture->setPosition(Vector2(size.width/2, size.height/2)); texture->setAnchorPoint(Vector2(0.5f,0.5f)); // render outScene to its texturebuffer texture->beginWithClear(0, 0, 0, 1); _sceneToBeModified->visit(); texture->end(); // Since we've passed the outScene to the texture we don't need it. if (_sceneToBeModified == _outScene) { hideOutShowIn(); } // We need the texture in RenderTexture. ProgressTimer *node = progressTimerNodeWithRenderTexture(texture); // create the blend action ActionInterval* layerAction = (ActionInterval*)Sequence::create( ProgressFromTo::create(_duration, _from, _to), CallFunc::create(CC_CALLBACK_0(TransitionScene::finish,this)), nullptr); // run the blend action node->runAction(layerAction); // add the layer (which contains our two rendertextures) to the scene addChild(node, 2, kSceneRadial); }