TransitionProgress
| 57 | |
| 58 | // TransitionProgress |
| 59 | void TransitionProgress::onEnter() |
| 60 | { |
| 61 | TransitionScene::onEnter(); |
| 62 | |
| 63 | setupTransition(); |
| 64 | |
| 65 | // create a transparent color layer |
| 66 | // in which we are going to add our rendertextures |
| 67 | auto& size = _director->getWinSize(); |
| 68 | |
| 69 | // create the second render texture for outScene |
| 70 | RenderTexture* texture = RenderTexture::create((int)size.width, (int)size.height, backend::PixelFormat::RGBA8, |
| 71 | backend::PixelFormat::D24S8); |
| 72 | texture->getSprite()->setAnchorPoint(Vec2(0.5f, 0.5f)); |
| 73 | texture->setPosition(size.width / 2, size.height / 2); |
| 74 | texture->setAnchorPoint(Vec2(0.5f, 0.5f)); |
| 75 | |
| 76 | // render outScene to its texturebuffer |
| 77 | texture->beginWithClear(0, 0, 0, 1); |
| 78 | _sceneToBeModified->visit(); |
| 79 | texture->end(); |
| 80 | |
| 81 | // Since we've passed the outScene to the texture we don't need it. |
| 82 | if (_sceneToBeModified == _outScene) |
| 83 | { |
| 84 | hideOutShowIn(); |
| 85 | } |
| 86 | // We need the texture in RenderTexture. |
| 87 | ProgressTimer* node = progressTimerNodeWithRenderTexture(texture); |
| 88 | |
| 89 | // create the blend action |
| 90 | auto layerAction = Sequence::create(ProgressFromTo::create(_duration, _from, _to), |
| 91 | CallFunc::create(AX_CALLBACK_0(TransitionScene::finish, this)), nullptr); |
| 92 | // run the blend action |
| 93 | node->runAction(layerAction); |
| 94 | |
| 95 | // add the layer (which contains our two rendertextures) to the scene |
| 96 | addChild(node, 2, kSceneRadial); |
| 97 | } |
| 98 | |
| 99 | // clean up on exit |
| 100 | void TransitionProgress::onExit() |
nothing calls this directly
no test coverage detected