随笔 - 112  文章 - 3  评论 - 0  阅读 - 44万

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   motoyang  阅读(343)  评论(0编辑  收藏  举报
< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

点击右上角即可分享
微信分享提示