Exemplo n.º 1
0
HelloWorld* HelloWorld::create(PhysicsWorld* world,int level)
{
	HelloWorld* pRet = new HelloWorld();
	if (pRet && pRet->init(world,level)){
		pRet->autorelease();
		return pRet;
	}
	delete pRet;
	pRet = NULL;
	return NULL;
}
Exemplo n.º 2
0
HelloWorld* HelloWorld::create() 
{ 
	HelloWorld* pRet = new HelloWorld(); 
	
	if (pRet && pRet->init()) 
	{ 
		pRet->autorelease();
		return pRet;
	}

	return NULL;
} 
Exemplo n.º 3
0
HelloWorld* HelloWorld::create() \
{ \
    HelloWorld *pRet = new HelloWorld(); \
    if (pRet && pRet->init()) \
    { \
        pRet->autorelease(); \
        return pRet; \
    } \
    else \
    { \
        delete pRet; \
        pRet = NULL; \
        return NULL; \
    } \
}
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }
    
    
    HelloWorld *obj = new HelloWorld();
    obj->autorelease();
    
    log("count: %d",obj->getReferenceCount());
    
//    release();
    
    return true;
}