예제 #1
0
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;
}
예제 #2
0
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;
}