示例#1
0
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;
}
示例#2
0
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;
}