I’ve subclassed Director to be able to do this. I did it originally for v2, but have ported it to v3. I’m happy to share the code:
class CustomDirector : public Director
template<class T> void popSceneWithTransition(float duration)
CCASSERT(_runningScene != NULL, "running scene should not null");
ssize_t c = _scenesStack.size();
if (c == 0)
Scene *scene = (Scene *)T::create(duration, (Scene *)_scenesStack.at(c-1));
_sendCleanupToScene = true;
_nextScene = (Scene*)_scenesStack.at(c - 1);
To use, simply:
CustomDirector *director = (CustomDirector *)Director::getInstance();
You can, of course, replace “TransitionSlideInR” with any other builtin or custom transition you want.
I’ve tested my v2 code quite heavily, but this one, not as much… so there may be bugs.