cocos2d popSceneWithTransition()方法

要在CCDirector.h中增加如下方法:

    template <typename T>

    void popSceneWithTransition(float t) {

        CCASSERT(_runningScene != nullptr, "running scene should not null");

        

        _scenesStack.popBack();

        ssize_t c = _scenesStack.size();

        

        if (c == 0)

        {

            end();

        }

        else

        {

            _sendCleanupToScene = true;

            Scene* scene = T::create(t, _scenesStack.at(c - 1));

            _scenesStack.replace(c - 1, scene);

            _nextScene = scene;

        }

    }

    

代码中使用的办法:

Director::getInstance()->popSceneWithTransition<TransitionSlideInR>(1.0);

 

posted on 2015-11-22 20:06  motoyang  阅读(340)  评论(0编辑  收藏  举报