mirror of https://github.com/axmolengine/axmol.git
parent
44ec769cf8
commit
b11c03cff3
|
@ -200,7 +200,11 @@ void CCDirector::mainLoop(void)
|
|||
CC_ENABLE_DEFAULT_GL_STATES();
|
||||
|
||||
// draw the scene
|
||||
m_pRunningScene->visit();
|
||||
if (m_pRunningScene)
|
||||
{
|
||||
m_pRunningScene->visit();
|
||||
}
|
||||
|
||||
if (m_bDisplayFPS)
|
||||
{
|
||||
showFPS();
|
||||
|
@ -590,7 +594,7 @@ void CCDirector::runWithScene(CCScene *pScene)
|
|||
startAnimation();
|
||||
|
||||
// render the 1st frame to avoid flicker (issue #350)
|
||||
mainLoop();
|
||||
//mainLoop();
|
||||
}
|
||||
|
||||
void CCDirector::replaceScene(CCScene *pScene)
|
||||
|
@ -681,22 +685,28 @@ void CCDirector::setNextScene(void)
|
|||
// If it is not a transition, call onExit/cleanup
|
||||
if (! newIsTransition)
|
||||
{
|
||||
m_pRunningScene->onExit();
|
||||
if (m_pRunningScene)
|
||||
{
|
||||
m_pRunningScene->onExit();
|
||||
}
|
||||
|
||||
// issue #709. the root node (scene) should receive the cleanup message too
|
||||
// otherwise it might be leaked.
|
||||
if (m_bSendCleanupToScene)
|
||||
if (m_bSendCleanupToScene && m_pRunningScene)
|
||||
{
|
||||
m_pRunningScene->cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
m_pRunningScene->release();
|
||||
m_pRunningScene = m_pNextScene;
|
||||
if (m_pRunningScene)
|
||||
{
|
||||
m_pRunningScene->release();
|
||||
}
|
||||
m_pRunningScene = m_pNextScene;
|
||||
m_pNextScene->retain();
|
||||
m_pNextScene = NULL;
|
||||
|
||||
if (! runningIsTransition)
|
||||
if (! runningIsTransition && m_pRunningScene)
|
||||
{
|
||||
m_pRunningScene->onEnter();
|
||||
m_pRunningScene->onEnterTransitionDidFinish();
|
||||
|
|
|
@ -63,6 +63,7 @@ CCNode::CCNode(void)
|
|||
,m_pChildren(NULL)
|
||||
// userData is always inited as nil
|
||||
,m_pUserData(NULL)
|
||||
,m_pParent(NULL)
|
||||
{
|
||||
// nothing
|
||||
}
|
||||
|
@ -614,7 +615,7 @@ void CCNode::reorderChild(CCNode *child, int zOrder)
|
|||
|
||||
void CCNode::draw()
|
||||
{
|
||||
assert(0);
|
||||
//assert(0);
|
||||
// override me
|
||||
// Only use- this function to draw your staff.
|
||||
// DON'T draw your stuff outside this method
|
||||
|
@ -635,11 +636,12 @@ void CCNode::visit()
|
|||
// }
|
||||
|
||||
this->transform();
|
||||
|
||||
|
||||
CCNode* pNode;
|
||||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
|
||||
if(m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
CCNode* pNode;
|
||||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
for( it = m_pChildren->begin(); it != m_pChildren->end(); it++)
|
||||
{
|
||||
pNode = (*it);
|
||||
|
@ -653,13 +655,19 @@ void CCNode::visit()
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->draw();
|
||||
this->draw();
|
||||
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
for ( ; it!=m_pChildren->end(); it++ )
|
||||
{
|
||||
pNode = (*it);
|
||||
pNode->visit();
|
||||
if (pNode)
|
||||
{
|
||||
pNode->visit();
|
||||
}
|
||||
}
|
||||
}
|
||||
/// @todo
|
||||
|
|
|
@ -231,7 +231,7 @@ void CCTouchDispatcher::setPriority(int nPriority, CCTouchDelegate *pDelegate)
|
|||
//
|
||||
void CCTouchDispatcher::touches(NSSet *pTouches, UIEvent *pEvent, unsigned int uIndex)
|
||||
{
|
||||
assert(uIndex > 0 && uIndex < 4);
|
||||
assert(uIndex >= 0 && uIndex < 4);
|
||||
|
||||
NSSet *pMutableTouches;
|
||||
m_bLocked = true;
|
||||
|
|
Loading…
Reference in New Issue