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

Method initWithDuration

core/2d/Transition.cpp:70–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70bool TransitionScene::initWithDuration(float t, Scene* scene)
71{
72 AXASSERT(scene != nullptr, "Argument scene must be non-nil");
73
74 if (Scene::init())
75 {
76 _duration = t;
77
78 // retain
79#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
80 auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
81 if (sEngine)
82 {
83 sEngine->retainScriptObject(this, scene);
84 }
85#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
86 _inScene = scene;
87 _inScene->retain();
88 _outScene = _director->getRunningScene();
89 if (_outScene == nullptr)
90 {
91 _outScene = Scene::create();
92 // just change its state is running that can run actions later
93 // issue: https://github.com/cocos2d/cocos2d-x/issues/17442
94 _outScene->onEnter();
95 }
96 _outScene->retain();
97
98 AXASSERT(_inScene != _outScene, "Incoming scene must be different from the outgoing scene");
99
100 sceneOrder();
101
102 return true;
103 }
104 else
105 {
106 return false;
107 }
108}
109
110void TransitionScene::sceneOrder()
111{

Callers 1

createMethod · 0.45

Calls 5

getInstanceFunction · 0.85
createFunction · 0.85
initFunction · 0.70
retainMethod · 0.45
onEnterMethod · 0.45

Tested by

no test coverage detected