Created
May 21, 2012 02:33
-
-
Save darkfall/2760319 to your computer and use it in GitHub Desktop.
Cocos2dx PopScene with Transition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
void CCDirector::popSceneWithTransition(float t) { | |
CCAssert(m_pRunningScene != NULL, "running scene should not null"); | |
m_pobScenesStack->removeLastObject(); | |
unsigned int c = m_pobScenesStack->count(); | |
if (c == 0) { | |
end(); | |
} | |
else { | |
m_bSendCleanupToScene = true; | |
m_pNextScene = m_pobScenesStack->getObjectAtIndex(c - 1); | |
CCScene* trans = T::transitionWithDuration(t, m_pNextScene); | |
m_pobScenesStack->replaceObjectAtIndex(c-1, trans); | |
m_pNextScene = trans; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
update code for cocos2d-x 3.0+