bool TMXMapImporter::loadOrthographicMap(const TiXmlElement *pElem)
{
	this->width = extractIntAtt(pElem, WIDTH_ATT);
	this->height = extractIntAtt(pElem, HEIGHT_ATT);
	this->tileWidth = extractIntAtt(pElem, TILEWIDTH_ATT);
	this->tileHeight = extractIntAtt(pElem, TILEHEIGHT_ATT);

	const TiXmlNode *node = pElem->FirstChild();
	while (node)
	{
		string eName = node->Value();
		if (strcmp(eName.c_str(), TILESET_ELEMENT.c_str()) == 0)
		{
			loadTileSetInfo(node);
		}
		else if (strcmp(eName.c_str(), IMAGELAYER_ELEMENT.c_str()) == 0)
		{
			loadImageLayerInfo(node);
		}
		else if (strcmp(eName.c_str(), LAYER_ELEMENT.c_str()) == 0)
		{
			loadTiledLayerInfo(node);
		}
		node = node->NextSibling();
	}
	return true;
}
Exemple #2
0
bool TMXMapImporter::loadIsometricMap(const TiXmlElement *pElem)
{
	this->width = extractIntAtt(pElem, WIDTH_ATT);
	this->height = extractIntAtt(pElem, HEIGHT_ATT);
	this->tileWidth = extractIntAtt(pElem, TILEWIDTH_ATT);
	this->tileHeight = extractIntAtt(pElem, TILEHEIGHT_ATT);

	const TiXmlNode *node = pElem->FirstChild();
	while (node)
	{
		string eName = node->Value();
		// TILESET_ELEMENT is tileset
		if (strcmp(eName.c_str(), TILESET_ELEMENT.c_str()) == 0)
		{
			loadTileSetInfo(node);
		}
		// IMAGELAYER_ELEMENT is imagelayer
		else if (strcmp(eName.c_str(), IMAGELAYER_ELEMENT.c_str()) == 0)
		{
			loadImageLayerInfo(node);
		}
		// LAYER_ELEMENT is layer
		else if (strcmp(eName.c_str(), LAYER_ELEMENT.c_str()) == 0)
		{
			loadTiledLayerInfo(node);
		}
		// OBJECT_GROUP_ELEMENT is objectgroup	
		else if (strcmp(eName.c_str(), OBJECT_GROUP_ELEMENT.c_str()) == 0)
		{
			loadSparseLayerInfo(node);
		}
		node = node->NextSibling();
	}
	return true;
}