|
|
|
|
|
|
|
#include <strstream>
|
|
|
|
#include "TMXParser.h"
|
|
|
|
|
|
|
|
int main(){
|
|
|
|
TMXParser parser("00_test_room.tmx");
|
|
|
|
Map mData = parser.GetData();
|
|
|
|
XMLTag mapTag = mData.MapData;
|
|
|
|
double version = mapTag.GetDouble("version");
|
|
|
|
bool isInfinite = mapTag.GetBool("infinite");
|
|
|
|
|
|
|
|
int TOTAL_LAYER_COUNT = mapTag.GetInteger("nextlayerid");
|
|
|
|
int X_TILES_COUNT = mapTag.GetInteger("width");
|
|
|
|
int Y_TILES_COUNT = mapTag.GetInteger("height");
|
|
|
|
|
|
|
|
std::vector<std::vector<std::vector<int>>> tileData;
|
|
|
|
for (int layer=0;layer<TOTAL_LAYER_COUNT-1;layer++) {
|
|
|
|
std::vector<std::vector<int>> mapTileGrid;
|
|
|
|
for (int y=0;y<Y_TILES_COUNT;y++) {
|
|
|
|
std::vector<int> row;
|
|
|
|
for (int x=0;x<X_TILES_COUNT;x++) {
|
|
|
|
row.push_back(mData.LayerData[layer].tiles[y][x]);
|
|
|
|
}
|
|
|
|
mapTileGrid.push_back(row);
|
|
|
|
}
|
|
|
|
tileData.push_back(mapTileGrid);
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("Layer 5, Row 115, Col 44 (X:43,Y:117) - %d",tileData[4][116][44]);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|