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);

 

你可能感兴趣的:(cocos2d popSceneWithTransition()方法)