Esempio n. 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;
}
Esempio n. 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;
}
Esempio n. 3
0
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;
}