Tip) implement popScene with Transition

The above implementations work up to 3.14 however, I think this solution is more elegant and requires less changes:

Replace the method declarations in CCDirector.h with these that take a function that wraps the new scene:

void popScene(std::function<Scene*(Scene* scene)> transition = [](Scene* scene){ return scene; });
void popToRootScene(std::function<Scene*(Scene* scene)> transition = [](Scene* scene){ return scene; });
void popToSceneStackLevel(int level, std::function<Scene*(Scene* scene)> transition = [](Scene* scene){ return scene; });

And replace the declarations in CCDirector.cpp with these:

void Director::popScene(std::function<Scene*(Scene* scene)> transition)
void Director::popToRootScene(std::function<Scene*(Scene* scene)> transition)
void Director::popToSceneStackLevel(int level, std::function<Scene*(Scene* scene)> transition)

Wrap your _nextScene = lines in the above methods like so:

_nextScene = transition(_scenesStack.at(c - 1)); // in popScene

popToSceneStackLevel(1, transition); // in popToRootScene

_nextScene = transition(_scenesStack.back()); / /in popToSceneStackLevel

Notice the wrapping function has a default function supplied, so you can continue to use these methods without supplying a transition function.

You can now call these functions like so:

popScene([](Scene* scene) {
    return TransitionMoveInL::create(0.3f, scene);
}

popToRootScene([](Scene* scene) {
    return TransitionMoveInL::create(0.3f, scene);
}

popToSceneStackLevel(5, [](Scene* scene) {
    return TransitionMoveInL::create(0.3f, scene);
}