当一个节点被创建
HelloWorld *layer = HelloWorld::create();
由于宏CREATE_FUNC
#define CREATE_FUNC(__TYPE__) \ static __TYPE__* create() \ { \ __TYPE__ *pRet = new __TYPE__(); \ if (pRet && pRet->init()) \ { \ pRet->autorelease(); \ return pRet; \ } \ else \ { \ delete pRet; \ pRet = NULL; \ return NULL; \ } \ }
onEnter是在哪里执行的呢?
void CCNode::addChild(CCNode *child,int zOrder,int tag) { CCAssert( child != NULL,"Argument must be non-nil"); CCAssert( child->m_pParent == NULL,"child already added. It can't be added again"); if( ! m_pChildren ) { this->childrenAlloc(); } this->insertChild(child,zOrder); child->m_nTag = tag; child->setParent(this); child->setOrderOfArrival(s_globalOrderOfArrival++); if( m_bRunning ) { child->onEnter(); child->onEnterTransitionDidFinish(); } }