Exemple #1
0
GameMap* GameMap::create( int mainLevel, int viceLevel )
{
	GameMap* ret = new GameMapRecrusive();
	if (ret->initWithLevel(mainLevel, viceLevel))
	{
		ret->autorelease();
		return ret;
	}
	CC_SAFE_DELETE(ret);
	return nullptr;
}
Exemple #2
0
GameMap* GameMap::gameMapWithTMXFile(const char *tmxFile)
{
	GameMap *pRet = new GameMap();

	if (pRet->initWithTMXFile(tmxFile))
	{
		pRet->extraInit();
		pRet->autorelease();
		return pRet;
	}

	CC_SAFE_DELETE(pRet);
	return NULL;
}
Exemple #3
0
GameMap* GameMap::gameMapWithTMXFile(const char *tmxFile)
{
	//new一个对象
	GameMap *pRet = new GameMap();
	//调用init方法
	if (pRet->initWithTMXFile(tmxFile))
	{
		
		//将实例放入autorelease池,统一由引擎控制对象的生命周期
		pRet->autorelease();
		return pRet;
	}
	CC_SAFE_DELETE(pRet);
	return NULL;
}
Exemple #4
0
GameMap* GameMap::create(int mapWidth, int mapHeight)
{
	GameMap* ret = new GameMap();
	if (ret && !ret->init()) {
		delete ret;
		return NULL;
	}

	ret->setMapWidth(mapWidth);
	ret->setMapHeight(mapHeight);
	ret->initMap();

	ret->autorelease();
	return ret;
}