BaseObject* BaseObject::create(cocos2d::Point position) { BaseObject* ret = new BaseObject(); if (ret != nullptr && ret->init(position)) { ret->autorelease(); return ret; } CC_SAFE_DELETE(ret); return nullptr; }
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; }