diff --git a/00_test_room.tmx b/00_test_room.tmx index db8aa51..e939c4b 100644 --- a/00_test_room.tmx +++ b/00_test_room.tmx @@ -1,5 +1,5 @@ - + diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 72191d5..cdcac90 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/TMXParser.h b/TMXParser.h index c5f6416..b5bd402 100644 --- a/TMXParser.h +++ b/TMXParser.h @@ -20,6 +20,21 @@ struct XMLTag{ rhs.FormatTagData(rhs.data) <<"\n"; return os; } + + int GetInteger(std::string dataTag) { + return std::stoi(data[dataTag]); + } + double GetDouble(std::string dataTag) { + return std::stod(data[dataTag]); + } + bool GetBool(std::string dataTag) { + if (data[dataTag]=="0") { + return false; + } else { + return true; + } + + } }; struct LayerTag{ @@ -53,6 +68,13 @@ struct Map{ }; class TMXParser{ + + public: + + Map GetData() { + return parsedMapInfo; + } + private: Map parsedMapInfo; @@ -71,6 +93,11 @@ class TMXParser{ } else { std::string key = data.substr(0,data.find("=")); std::string value = data.substr(data.find("=")+1,std::string::npos); + + //Strip Quotation marks. + value = value.substr(1,std::string::npos); + value = value.substr(0,value.length()-1); + newTag.data[key]=value; std::cout<<" "<