找到CCDirector.h,找到void popScene();
在下面加上一段类模板
template <class T>
void popSceneWithTransition(float t)
{
CCASSERT(_runningScene != nullptr, "running scene should not null"); _scenesStack.popBack();
ssize_t c = _scenesStack.size(); if (c == )
{
end();
}
else
{
_sendCleanupToScene = true;
Scene* scene = T::create(t, _scenesStack.at(c - ));
_scenesStack.replace(c - , scene);
_nextScene = scene;
}
}
在需要调用的地方,一句话
Director::getInstance()->popSceneWithTransition<TransitionFade>(1.0);
常用的Transition应该都可以用