Example #1
0
PhysicsWorld* PhysicsWorld::construct(Scene& scene)
{
    PhysicsWorld * world = new PhysicsWorld();
    if(world && world->init(scene))
    {
        return world;
    }
    
    CC_SAFE_DELETE(world);
    return nullptr;
}
Example #2
0
PhysicsWorld* PhysicsWorld::create()
{
    PhysicsWorld* instance = new PhysicsWorld();

    if(instance && instance->init())
    {
        return instance;
    }

    delete instance;
    return NULL;
}
PhysicsWorld* PhysicsWorld::construct(Scene* scene)
{
    PhysicsWorld * world = new (std::nothrow) PhysicsWorld();
    if (world && world->init())
    {
        world->_scene = scene;
        world->_eventDispatcher = scene->getEventDispatcher();
        return world;
    }

    CC_SAFE_DELETE(world);
    return nullptr;
}