Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cocos2dx PopScene with Transition
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;
}
}
@fnc12

This comment has been minimized.

Copy link

@fnc12 fnc12 commented Oct 6, 2015

update code for cocos2d-x 3.0+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment