Beispiel #1
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;
}
Beispiel #2
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;
}