MCPcopy Create free account
hub / github.com/axmolengine/axmol / onEnter

Method onEnter

core/2d/TransitionProgress.cpp:59–97  ·  view source on GitHub ↗

TransitionProgress

Source from the content-addressed store, hash-verified

57
58// TransitionProgress
59void 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
100void TransitionProgress::onExit()

Callers

nothing calls this directly

Calls 9

createFunction · 0.85
beginWithClearMethod · 0.80
Vec2Class · 0.70
setAnchorPointMethod · 0.45
getSpriteMethod · 0.45
setPositionMethod · 0.45
visitMethod · 0.45
endMethod · 0.45
runActionMethod · 0.45

Tested by

no test coverage detected