今天才知道cocos2dx popScene 没有Transition,只能生硬地切换,不能忍...搜索了一下,分享小技巧~
在头文件中增加两个方法:
Scene * getPrevIoUsScene();voID popSceneWithTransition(Scene *trans);
Director.cpp 实现如下:
Scene * Director::getPrevIoUsScene(){ ssize_t c = _scenesStack.size(); if (c <= 1) return NulL; return (Scene*)_scenesStack.at(c - 2);}voID Director::popSceneWithTransition(Scene * trans){ log("popSceneWithTransition+++++++++++++++++++++++++++++++stack size = %zd",_scenesStack.size()); CCASSERT(_runningScene != NulL,"running scene should not null"); _scenesStack.popBack(); ssize_t c = _scenesStack.size(); if (c == 0) { end(); } else { _sendCleanupToScene = true; _nextScene = trans; // (CCScene*)m_pobScenesStack->objectAtIndex(c - 1); }} 用法如下:
Scene *preScene = Director::getInstance() -> getPrevIoUsScene(); TransitionScene *Transition = TransitionSlIDeInL::create(0.3,preScene);Director::getInstance() -> popSceneWithTransition(Transition); 欢迎访问我的博客:helkyle.tk
总结 以上是内存溢出为你收集整理的cocos2dx popScene 使用 Transition小技巧全部内容,希望文章能够帮你解决cocos2dx popScene 使用 Transition小技巧所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)