CCCallLambda * CCCallLambda::create(boost::function<void ()> lambda) { CCCallLambda *pRet = new CCCallLambda(); if (pRet && pRet->initWithTarget(lambda)) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; }
NS_CC_BEGIN CCCallLambda* CCCallLambda::create(const std::function<void(void)>& func) { CCCallLambda* pRet = new CCCallLambda(); if (pRet && pRet->initWithLambda(func)) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; }
CCObject * CCCallLambda::copyWithZone(CCZone *pZone) { CCZone* pNewZone = NULL; CCCallLambda* pRet = NULL; if (pZone && pZone->m_pCopyObject) { //in case of being called at sub class pRet = (CCCallLambda*) (pZone->m_pCopyObject); } else { pRet = new CCCallLambda(); pZone = pNewZone = new CCZone(pRet); } CCActionInstant::copyWithZone(pZone); pRet->initWithTarget(mLambda); CC_SAFE_DELETE(pNewZone); return pRet; }
CCObject* CCCallLambda::copyWithZone(CCZone *pZone) { CCZone* pNewZone = nullptr; CCCallLambda* pRet = nullptr; if (pZone && pZone->m_pCopyObject) { pRet = (CCCallLambda*) (pZone->m_pCopyObject); } else { pRet = new CCCallLambda(); pZone = pNewZone = new CCZone(pRet); } CCActionInstant::copyWithZone(pZone); pRet->initWithLambda(mFunction); CC_SAFE_DELETE(pNewZone); return pRet; }