zoukankan      html  css  js  c++  java
  • cocos2d-x的popScene的动画效果

    找到CCDirector.h,找到void popScene();

    在下面加上一段类模板

    template <class 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<TransitionFade>(1.0);

    常用的Transition应该都可以用

  • 相关阅读:
    php数组
    php数组排序
    php超级全局变量
    php循环
    php函数
    PHP魔术常量
    php面向对象
    static 关键字
    Final 关键字
    内置函数
  • 原文地址:https://www.cnblogs.com/ziyouchutuwenwu/p/3883532.html
Copyright © 2011-2022 走看看