BaseObject* BaseObject::create(std::string fileName) { BaseObject *sprite = new (std::nothrow) BaseObject(); if (sprite && sprite->initWithFile(fileName) && sprite->init()) { sprite->autorelease(); return sprite; } CC_SAFE_DELETE(sprite); return nullptr; }
BaseObject* BaseObject::create(const std::string& filename, const Rect& rect) { BaseObject *sprite = new (std::nothrow) BaseObject(); if (sprite && sprite->initWithFile(filename, rect)) { sprite->autorelease(); return sprite; } CC_SAFE_DELETE(sprite); return nullptr; }