From 1fcb935d795a05a6ed53941e227e4d10bc3b184c Mon Sep 17 00:00:00 2001
From: Tamir Atias <engine.games@gmail.com>
Date: Sun, 2 Sep 2012 14:11:42 +0300
Subject: [PATCH] [Update] Tmx Parser updated to latest revision.

---
 Bin/LibD.pro                          |  56 +--
 src/Level/Level.cpp                   |   9 +-
 src/TMXParser/Tmx.h                   |  78 ++--
 src/TMXParser/TmxImage.cpp            | 120 +++---
 src/TMXParser/TmxImage.h              | 132 +++----
 src/TMXParser/TmxLayer.cpp            | 506 +++++++++++++------------
 src/TMXParser/TmxLayer.h              | 273 +++++++-------
 src/TMXParser/TmxMap.cpp              | 515 +++++++++++++-------------
 src/TMXParser/TmxMap.h                | 345 ++++++++---------
 src/TMXParser/TmxMapTile.h            | 153 ++++----
 src/TMXParser/TmxObject.cpp           | 214 +++++------
 src/TMXParser/TmxObject.h             | 194 +++++-----
 src/TMXParser/TmxObjectGroup.cpp      | 152 ++++----
 src/TMXParser/TmxObjectGroup.h        | 166 ++++-----
 src/TMXParser/TmxPoint.h              |  78 ++--
 src/TMXParser/TmxPolygon.cpp          | 112 +++---
 src/TMXParser/TmxPolygon.h            | 114 +++---
 src/TMXParser/TmxPolyline.cpp         | 112 +++---
 src/TMXParser/TmxPolyline.h           | 114 +++---
 src/TMXParser/TmxPropertySet.cpp      | 156 ++++----
 src/TMXParser/TmxPropertySet.h        | 134 +++----
 src/TMXParser/TmxTile.cpp             | 110 +++---
 src/TMXParser/TmxTile.h               | 120 +++---
 src/TMXParser/TmxTileset.cpp          | 246 ++++++------
 src/TMXParser/TmxTileset.h            | 190 +++++-----
 src/TMXParser/TmxUtil.cpp             | 214 +++++------
 src/TMXParser/TmxUtil.h               |  84 ++---
 src/TMXParser/{ => base64}/base64.cpp | 244 ++++++------
 src/TMXParser/{ => base64}/base64.h   |  68 ++--
 29 files changed, 2544 insertions(+), 2465 deletions(-)
 rename src/TMXParser/{ => base64}/base64.cpp (96%)
 rename src/TMXParser/{ => base64}/base64.h (96%)

diff --git a/Bin/LibD.pro b/Bin/LibD.pro
index 1343b4e..e78d2a5 100644
--- a/Bin/LibD.pro
+++ b/Bin/LibD.pro
@@ -38,20 +38,6 @@ HEADERS += ../src/Actor/Player.h \
     ../src/System/ResourceManager.h \
     ../src/Texture/Texture.h \
     ../src/Sound/Music.h \
-    ../src/TMXParser/TmxUtil.h \
-    ../src/TMXParser/TmxTileset.h \
-    ../src/TMXParser/TmxTile.h \
-    ../src/TMXParser/TmxPropertySet.h \
-    ../src/TMXParser/TmxPolyline.h \
-    ../src/TMXParser/TmxPolygon.h \
-    ../src/TMXParser/TmxObjectGroup.h \
-    ../src/TMXParser/TmxObject.h \
-    ../src/TMXParser/TmxMapTile.h \
-    ../src/TMXParser/TmxImage.h \
-    ../src/TMXParser/TmxPoint.h \
-    ../src/TMXParser/TmxMap.h \
-    ../src/TMXParser/TmxLayer.h \
-    ../src/TMXParser/Tmx.h \
     ../src/TMXParser/base64.h \
     ../src/Collision/TileCollision.h \
     ../src/Actor/NPC.h \
@@ -68,7 +54,21 @@ HEADERS += ../src/Actor/Player.h \
     ../src/Main/TitleScreen.h \
     ../src/Level/Warp.h \
     ../src/Math/Rect.h \
-    ../src/BattleSys/Slot.h
+    ../src/BattleSys/Slot.h \
+    ../src/TMXParser/TmxTile.h \
+    ../src/TMXParser/TmxPropertySet.h \
+    ../src/TMXParser/TmxPolyline.h \
+    ../src/TMXParser/TmxPolygon.h \
+    ../src/TMXParser/TmxPoint.h \
+    ../src/TMXParser/TmxObjectGroup.h \
+    ../src/TMXParser/TmxObject.h \
+    ../src/TMXParser/TmxMapTile.h \
+    ../src/TMXParser/TmxMap.h \
+    ../src/TMXParser/TmxLayer.h \
+    ../src/TMXParser/TmxImage.h \
+    ../src/TMXParser/Tmx.h \
+    ../src/TMXParser/base64/base64.h \
+    ../src/TMXParser/TmxUtil.h
 
 SOURCES += ../src/Actor/Player.cpp \
     ../src/Collision/AABB.cpp \
@@ -87,18 +87,6 @@ SOURCES += ../src/Actor/Player.cpp \
     ../src/System/Debug.cpp \
     ../src/Texture/Texture.cpp \
     ../src/Sound/Music.cpp \
-    ../src/TMXParser/TmxUtil.cpp \
-    ../src/TMXParser/TmxTileset.cpp \
-    ../src/TMXParser/TmxTile.cpp \
-    ../src/TMXParser/TmxPropertySet.cpp \
-    ../src/TMXParser/TmxPolyline.cpp \
-    ../src/TMXParser/TmxPolygon.cpp \
-    ../src/TMXParser/TmxObjectGroup.cpp \
-    ../src/TMXParser/TmxObject.cpp \
-    ../src/TMXParser/TmxMap.cpp \
-    ../src/TMXParser/TmxLayer.cpp \
-    ../src/TMXParser/TmxImage.cpp \
-    ../src/TMXParser/base64.cpp \
     ../src/Actor/NPC.cpp \
     ../src/Sound/SoundEffect.cpp \
     ../src/Actor/Actor.cpp \
@@ -111,6 +99,18 @@ SOURCES += ../src/Actor/Player.cpp \
     ../src/UI/Button.cpp \
     ../src/Main/TitleScreen.cpp \
     ../src/Level/Warp.cpp \
-    ../src/BattleSys/Slot.cpp
+    ../src/BattleSys/Slot.cpp \
+    ../src/TMXParser/TmxTileset.cpp \
+    ../src/TMXParser/TmxTile.cpp \
+    ../src/TMXParser/TmxPropertySet.cpp \
+    ../src/TMXParser/TmxPolyline.cpp \
+    ../src/TMXParser/TmxPolygon.cpp \
+    ../src/TMXParser/TmxObjectGroup.cpp \
+    ../src/TMXParser/TmxObject.cpp \
+    ../src/TMXParser/TmxMap.cpp \
+    ../src/TMXParser/TmxLayer.cpp \
+    ../src/TMXParser/TmxImage.cpp \
+    ../src/TMXParser/base64/base64.cpp \
+    ../src/TMXParser/TmxUtil.cpp
 
 QMAKE_CLEAN += LibD Debug.log
diff --git a/src/Level/Level.cpp b/src/Level/Level.cpp
index 8d90df8..73bf1a9 100644
--- a/src/Level/Level.cpp
+++ b/src/Level/Level.cpp
@@ -102,7 +102,7 @@ bool Level::Load(const std::string& filename) {
       for(int x = 0; x < _width; x++) {
         for(int y = 0; y < _height; y++) {
           Tmx::MapTile tile = tmxLayer->GetTile(x, y);
-          _collisions[y * _width + x] = tile.gid != 0;
+          _collisions[y * _width + x] = tile.tilesetId > -1;
         }
       }
       continue;
@@ -119,11 +119,10 @@ bool Level::Load(const std::string& filename) {
       for(int y = 0; y < layer->GetHeight(); y++) {
         Tmx::MapTile tmxTile = tmxLayer->GetTile(x, y);
 
-        const Tmx::Tileset* tmxTileset = map.FindTileset(tmxTile.gid);
-
         MapTile tile;
-        if(tmxTile.gid != 0) {
-          tile.id = tmxTile.gid - tmxTileset->GetFirstGid();
+        if(tmxTile.tilesetId != -1) {
+          const Tmx::Tileset* tmxTileset = map.GetTileset(tmxTile.tilesetId);
+          tile.id = tmxTile.id;
           tile.tileset = tilesetMap.find(tmxTileset)->second;
         } else {
           tile.id = 0;
diff --git a/src/TMXParser/Tmx.h b/src/TMXParser/Tmx.h
index 8b455cb..48e79d7 100644
--- a/src/TMXParser/Tmx.h
+++ b/src/TMXParser/Tmx.h
@@ -1,40 +1,40 @@
-//-----------------------------------------------------------------------------
-// TmxImage.h
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#pragma once
-
-#include "TmxMap.h"
-#include "TmxTileset.h"
-#include "TmxTile.h"
-#include "TmxImage.h"
-#include "TmxLayer.h"
-#include "TmxObject.h"
-#include "TmxObjectGroup.h"
-#include "TmxPolygon.h"
-#include "TmxPolyline.h"
-#include "TmxPropertySet.h"
+//-----------------------------------------------------------------------------
+// TmxImage.h
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#pragma once
+
+#include "TmxMap.h"
+#include "TmxTileset.h"
+#include "TmxTile.h"
+#include "TmxImage.h"
+#include "TmxLayer.h"
+#include "TmxObject.h"
+#include "TmxObjectGroup.h"
+#include "TmxPolygon.h"
+#include "TmxPolyline.h"
+#include "TmxPropertySet.h"
 #include "TmxUtil.h"
\ No newline at end of file
diff --git a/src/TMXParser/TmxImage.cpp b/src/TMXParser/TmxImage.cpp
index ba7c913..876844d 100644
--- a/src/TMXParser/TmxImage.cpp
+++ b/src/TMXParser/TmxImage.cpp
@@ -1,60 +1,60 @@
-//-----------------------------------------------------------------------------
-// TmxImage.cpp
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#include <tinyxml.h>
-
-#include "TmxImage.h"
-
-namespace Tmx 
-{	
-	Image::Image() 
-		: source()
-		, width()
-		, height()
-		, transparent_color()
-	{}
-
-	Image::~Image() 
-	{}
-
-	void Image::Parse(const TiXmlNode *imageNode) 
-	{
-		const TiXmlElement* imageElem = imageNode->ToElement();
-		
-		// Read all the attribute into member variables.
-		source = imageElem->Attribute("source");
-
-		imageElem->Attribute("width", &width);
-		imageElem->Attribute("height", &height);
-
-		const char *trans = imageElem->Attribute("trans");
-		if (trans) 
-		{
-			transparent_color = trans;
-		}
-	}
-};
\ No newline at end of file
+//-----------------------------------------------------------------------------
+// TmxImage.cpp
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#include <tinyxml.h>
+
+#include "TmxImage.h"
+
+namespace Tmx 
+{	
+	Image::Image() 
+		: source()
+		, width()
+		, height()
+		, transparent_color()
+	{}
+
+	Image::~Image() 
+	{}
+
+	void Image::Parse(const TiXmlNode *imageNode) 
+	{
+		const TiXmlElement* imageElem = imageNode->ToElement();
+		
+		// Read all the attribute into member variables.
+		source = imageElem->Attribute("source");
+
+		imageElem->Attribute("width", &width);
+		imageElem->Attribute("height", &height);
+
+		const char *trans = imageElem->Attribute("trans");
+		if (trans) 
+		{
+			transparent_color = trans;
+		}
+	}
+};
diff --git a/src/TMXParser/TmxImage.h b/src/TMXParser/TmxImage.h
index 304f847..03fdee0 100644
--- a/src/TMXParser/TmxImage.h
+++ b/src/TMXParser/TmxImage.h
@@ -1,67 +1,67 @@
-//-----------------------------------------------------------------------------
-// TmxImage.h
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#pragma once
-
-#include <string>
-
-class TiXmlNode;
-
-namespace Tmx 
-{
-	//-------------------------------------------------------------------------
-	// An image within a tileset.
-	//-------------------------------------------------------------------------
-	class Image 
-	{
-	public:
-		Image();
-		~Image();
-
-		// Parses an image element.
-		void Parse(const TiXmlNode *imageNode);
-
-		// Get the path to the file of the image (relative to the map)
-		const std::string &GetSource() const { return source; }
-
-		// Get the width of the image.
-		int GetWidth() const { return width; }
-
-		// Get the height of the image.
-		int GetHeight() const { return height; }
-
-		// Get the transparent color used in the image.
-		const std::string &GetTransparentColor() const 
-		{ return transparent_color; }
-
-	private:
-		std::string source;
-		int width;
-		int height;
-		std::string transparent_color;
-	};
+//-----------------------------------------------------------------------------
+// TmxImage.h
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#pragma once
+
+#include <string>
+
+class TiXmlNode;
+
+namespace Tmx 
+{
+	//-------------------------------------------------------------------------
+	// An image within a tileset.
+	//-------------------------------------------------------------------------
+	class Image 
+	{
+	public:
+		Image();
+		~Image();
+
+		// Parses an image element.
+		void Parse(const TiXmlNode *imageNode);
+
+		// Get the path to the file of the image (relative to the map)
+		const std::string &GetSource() const { return source; }
+
+		// Get the width of the image.
+		int GetWidth() const { return width; }
+
+		// Get the height of the image.
+		int GetHeight() const { return height; }
+
+		// Get the transparent color used in the image.
+		const std::string &GetTransparentColor() const 
+		{ return transparent_color; }
+
+	private:
+		std::string source;
+		int width;
+		int height;
+		std::string transparent_color;
+	};
 };
\ No newline at end of file
diff --git a/src/TMXParser/TmxLayer.cpp b/src/TMXParser/TmxLayer.cpp
index ff1def8..277380b 100644
--- a/src/TMXParser/TmxLayer.cpp
+++ b/src/TMXParser/TmxLayer.cpp
@@ -1,229 +1,277 @@
-//-----------------------------------------------------------------------------
-// TmxLayer.cpp
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#include <stdlib.h>
-#include <zlib.h>
-#include <tinyxml.h>
-
-#include "TmxLayer.h"
-#include "TmxUtil.h"
-
-namespace Tmx 
-{
-	Layer::Layer() 
-		: name() 
-		, width(0) 
-		, height(0) 
-		, opacity(1.0f)
-		, visible(true)
-		, properties()
-		, encoding(TMX_ENCODING_XML)
-		, compression(TMX_COMPRESSION_NONE)
-	{
-		// Set the map to null to specify that it is not yet allocated.
-		tile_map = NULL;
-	}
-
-	Layer::~Layer() 
-	{
-		// If the tile map is allocated, delete it from the memory.
-		if (tile_map)
-		{
-			delete [] tile_map;
-			tile_map = NULL;
-		}
-	}
-
-	void Layer::Parse(const TiXmlNode *layerNode) 
-	{
-		const TiXmlElement *layerElem = layerNode->ToElement();
-	
-		// Read the attributes.
-		name = layerElem->Attribute("name");
-
-		layerElem->Attribute("width", &width);
-		layerElem->Attribute("height", &height);
-
-		const char *opacityStr = layerElem->Attribute("opacity");
-		if (opacityStr) 
-		{
-			opacity = (float)atof(opacityStr);
-		}
-
-		const char *visibleStr = layerElem->Attribute("visible");
-		if (visibleStr) 
-		{
-			visible = atoi(visibleStr) != 0; // to prevent visual c++ from complaining..
-		}
-
-		// Read the properties.
-		const TiXmlNode *propertiesNode = layerNode->FirstChild("properties");
-		if (propertiesNode) 
-		{
-			properties.Parse(propertiesNode);
-		}
-
-		// Allocate memory for reading the tiles.
-		tile_map = new MapTile[width * height];
-
-		const TiXmlNode *dataNode = layerNode->FirstChild("data");
-		const TiXmlElement *dataElem = dataNode->ToElement();
-
-		const char *encodingStr = dataElem->Attribute("encoding");
-		const char *compressionStr = dataElem->Attribute("compression");
-
-		// Check for encoding.
-		if (encodingStr) 
-		{
-			if (!strcmp(encodingStr, "base64")) 
-			{
-				encoding = TMX_ENCODING_BASE64;
-			} 
-			else if (!strcmp(encodingStr, "csv")) 
-			{
-				encoding = TMX_ENCODING_CSV;
-			}
-		}
-
-		// Check for compression.
-		if (compressionStr) 
-		{
-			if (!strcmp(compressionStr, "gzip")) 
-			{
-				compression = TMX_COMPRESSION_GZIP;
-			} 
-			else if (!strcmp(compressionStr, "zlib")) 
-			{
-				compression = TMX_COMPRESSION_ZLIB;
-			}
-		}
-		
-		// Decode.
-		switch (encoding) 
-		{
-		case TMX_ENCODING_XML:
-			ParseXML(dataNode);
-			break;
-
-		case TMX_ENCODING_BASE64:
-			ParseBase64(dataElem->GetText());
-			break;
-
-		case TMX_ENCODING_CSV:
-			ParseCSV(dataElem->GetText());
-			break;
-		}
-	}
-
-	void Layer::ParseXML(const TiXmlNode *dataNode) 
-	{
-		const TiXmlNode *tileNode = dataNode->FirstChild("tile");
-		int tileCount = 0;
-
-		while (tileNode) 
-		{
-			const TiXmlElement *tileElem = tileNode->ToElement();
-			
-			int gid = 0;
-
-			// Read the Global-ID of the tile directly into the array entry.
-			tileElem->Attribute("gid", &gid);
-
-			// Convert the gid to a map tile.
-			tile_map[tileCount++] = MapTile((unsigned)gid);
-
-			tileNode = dataNode->IterateChildren("tile", tileNode);
-		}
-	}
-
-	void Layer::ParseBase64(const std::string &innerText) 
-	{
-		const std::string &text = Util::DecodeBase64(innerText);
-
-		// Temporary array of gids to be converted to map tiles.
-		unsigned *out = 0;
-
-		if (compression == TMX_COMPRESSION_ZLIB) 
-		{
-			// Use zlib to uncompress the layer into the temporary array of tiles.
-			uLongf outlen = width * height * 4;
-			out = (unsigned *)malloc(outlen);
-			uncompress(
-				(Bytef*)out, &outlen, 
-				(const Bytef*)text.c_str(), text.size());
-	
-		} 
-		else if (compression == TMX_COMPRESSION_GZIP) 
-		{
-			// Use the utility class for decompressing (which uses zlib)
-			out = (unsigned *)Util::DecompressGZIP(
-				text.c_str(), 
-				text.size(), 
-				width * height * 4);
-		} 
-		else 
-		{
-			out = (unsigned *)malloc(text.size());
-		
-			// Copy every gid into the temporary array since
-			// the decoded string is an array of 32-bit integers.
-			memcpy(out, text.c_str(), text.size());
-		}
-
-		// Convert the gids to map tiles.
-		for (int x = 0; x < width; x++)
-		{
-			for (int y = 0; y < height; y++)
-			{
-				tile_map[y * width + x] = MapTile(out[y * width + x]);
-			}
-		}
-
-		// Free the temporary array from memory.
-		free(out);
-	}
-
-	void Layer::ParseCSV(const std::string &innerText) 
-	{
-		// Duplicate the string for use with C stdio.
-		char *csv = strdup(innerText.c_str());
-		
-		// Iterate through every token of ';' in the CSV string.
-		char *pch = strtok(csv, ";");
-		int tileCount = 0;
-		
-		while (pch) 
-		{
-			tile_map[tileCount] = MapTile((unsigned)atoi(pch));
-
-			++tileCount;
-			pch = strtok(NULL, ";");
-		}
-
-		free(csv);
-	}
-};
+//-----------------------------------------------------------------------------
+// TmxLayer.cpp
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#include <tinyxml.h>
+#include <zlib.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "TmxLayer.h"
+#include "TmxUtil.h"
+#include "TmxMap.h"
+#include "TmxTileset.h"
+
+namespace Tmx 
+{
+	Layer::Layer(const Map *_map) 
+		: map(_map)
+		, name() 
+		, width(0) 
+		, height(0) 
+		, opacity(1.0f)
+		, visible(true)
+		, properties()
+		, encoding(TMX_ENCODING_XML)
+		, compression(TMX_COMPRESSION_NONE)
+	{
+		// Set the map to null to specify that it is not yet allocated.
+		tile_map = NULL;
+	}
+
+	Layer::~Layer() 
+	{
+		// If the tile map is allocated, delete it from the memory.
+		if (tile_map)
+		{
+			delete [] tile_map;
+			tile_map = NULL;
+		}
+	}
+
+	void Layer::Parse(const TiXmlNode *layerNode) 
+	{
+		const TiXmlElement *layerElem = layerNode->ToElement();
+	
+		// Read the attributes.
+		name = layerElem->Attribute("name");
+
+		layerElem->Attribute("width", &width);
+		layerElem->Attribute("height", &height);
+
+		const char *opacityStr = layerElem->Attribute("opacity");
+		if (opacityStr) 
+		{
+			opacity = (float)atof(opacityStr);
+		}
+
+		const char *visibleStr = layerElem->Attribute("visible");
+		if (visibleStr) 
+		{
+			visible = atoi(visibleStr) != 0; // to prevent visual c++ from complaining..
+		}
+
+		// Read the properties.
+		const TiXmlNode *propertiesNode = layerNode->FirstChild("properties");
+		if (propertiesNode) 
+		{
+			properties.Parse(propertiesNode);
+		}
+
+		// Allocate memory for reading the tiles.
+		tile_map = new MapTile[width * height];
+
+		const TiXmlNode *dataNode = layerNode->FirstChild("data");
+		const TiXmlElement *dataElem = dataNode->ToElement();
+
+		const char *encodingStr = dataElem->Attribute("encoding");
+		const char *compressionStr = dataElem->Attribute("compression");
+
+		// Check for encoding.
+		if (encodingStr) 
+		{
+			if (!strcmp(encodingStr, "base64")) 
+			{
+				encoding = TMX_ENCODING_BASE64;
+			} 
+			else if (!strcmp(encodingStr, "csv")) 
+			{
+				encoding = TMX_ENCODING_CSV;
+			}
+		}
+
+		// Check for compression.
+		if (compressionStr) 
+		{
+			if (!strcmp(compressionStr, "gzip")) 
+			{
+				compression = TMX_COMPRESSION_GZIP;
+			} 
+			else if (!strcmp(compressionStr, "zlib")) 
+			{
+				compression = TMX_COMPRESSION_ZLIB;
+			}
+		}
+		
+		// Decode.
+		switch (encoding) 
+		{
+		case TMX_ENCODING_XML:
+			ParseXML(dataNode);
+			break;
+
+		case TMX_ENCODING_BASE64:
+			ParseBase64(dataElem->GetText());
+			break;
+
+		case TMX_ENCODING_CSV:
+			ParseCSV(dataElem->GetText());
+			break;
+		}
+	}
+
+	void Layer::ParseXML(const TiXmlNode *dataNode) 
+	{
+		const TiXmlNode *tileNode = dataNode->FirstChild("tile");
+		int tileCount = 0;
+
+		while (tileNode) 
+		{
+			const TiXmlElement *tileElem = tileNode->ToElement();
+			
+			unsigned gid = 0;
+
+			// Read the Global-ID of the tile.
+			const char* gidText = tileElem->Attribute("gid");
+
+			// Convert to an unsigned.
+			sscanf(gidText, "%u", &gid);
+
+			// Find the tileset index.
+			const int tilesetIndex = map->FindTilesetIndex(gid);
+			if (tilesetIndex != -1)
+			{
+				// If valid, set up the map tile with the tileset.
+				const Tmx::Tileset* tileset = map->GetTileset(tilesetIndex);
+				tile_map[tileCount] = MapTile(gid, tileset->GetFirstGid(), tilesetIndex);
+			}
+			else
+			{
+				// Otherwise, make it null.
+				tile_map[tileCount] = MapTile(gid, 0, -1);
+			}
+
+			tileNode = dataNode->IterateChildren("tile", tileNode);
+			tileCount++;
+		}
+	}
+
+	void Layer::ParseBase64(const std::string &innerText) 
+	{
+		const std::string &text = Util::DecodeBase64(innerText);
+
+		// Temporary array of gids to be converted to map tiles.
+		unsigned *out = 0;
+
+		if (compression == TMX_COMPRESSION_ZLIB) 
+		{
+			// Use zlib to uncompress the layer into the temporary array of tiles.
+			uLongf outlen = width * height * 4;
+			out = (unsigned *)malloc(outlen);
+			uncompress(
+				(Bytef*)out, &outlen, 
+				(const Bytef*)text.c_str(), text.size());
+	
+		} 
+		else if (compression == TMX_COMPRESSION_GZIP) 
+		{
+			// Use the utility class for decompressing (which uses zlib)
+			out = (unsigned *)Util::DecompressGZIP(
+				text.c_str(), 
+				text.size(), 
+				width * height * 4);
+		} 
+		else 
+		{
+			out = (unsigned *)malloc(text.size());
+		
+			// Copy every gid into the temporary array since
+			// the decoded string is an array of 32-bit integers.
+			memcpy(out, text.c_str(), text.size());
+		}
+
+		// Convert the gids to map tiles.
+		for (int x = 0; x < width; x++)
+		{
+			for (int y = 0; y < height; y++)
+			{
+				unsigned gid = out[y * width + x];
+
+				// Find the tileset index.
+				const int tilesetIndex = map->FindTilesetIndex(gid);
+				if (tilesetIndex != -1)
+				{
+					// If valid, set up the map tile with the tileset.
+					const Tmx::Tileset* tileset = map->GetTileset(tilesetIndex);
+					tile_map[y * width + x] = MapTile(gid, tileset->GetFirstGid(), tilesetIndex);
+				}
+				else
+				{
+					// Otherwise, make it null.
+					tile_map[y * width + x] = MapTile(gid, 0, -1);
+				}
+			}
+		}
+
+		// Free the temporary array from memory.
+		free(out);
+	}
+
+	void Layer::ParseCSV(const std::string &innerText) 
+	{
+		// Duplicate the string for use with C stdio.
+		char *csv = strdup(innerText.c_str());
+		
+		// Iterate through every token of ';' in the CSV string.
+		char *pch = strtok(csv, ",");
+		int tileCount = 0;
+		
+		while (pch) 
+		{
+			unsigned gid;
+			sscanf(pch, "%u", &gid);
+
+			// Find the tileset index.
+			const int tilesetIndex = map->FindTilesetIndex(gid);
+			if (tilesetIndex != -1)
+			{
+				// If valid, set up the map tile with the tileset.
+				const Tmx::Tileset* tileset = map->GetTileset(tilesetIndex);
+				tile_map[tileCount] = MapTile(gid, tileset->GetFirstGid(), tilesetIndex);
+			}
+			else
+			{
+				// Otherwise, make it null.
+				tile_map[tileCount] = MapTile(gid, 0, -1);
+			}
+
+			pch = strtok(NULL, ",");
+			tileCount++;
+		}
+
+		free(csv);
+	}
+};
diff --git a/src/TMXParser/TmxLayer.h b/src/TMXParser/TmxLayer.h
index 83d1668..b6aa821 100644
--- a/src/TMXParser/TmxLayer.h
+++ b/src/TMXParser/TmxLayer.h
@@ -1,133 +1,140 @@
-//-----------------------------------------------------------------------------
-// TmxLayer.h
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#pragma once
-
-#include <string>
-
-#include "TmxPropertySet.h"
-#include "TmxMapTile.h"
-
-class TiXmlNode;
-
-namespace Tmx
-{
-  //-------------------------------------------------------------------------
-  // Type used for the encoding of the layer data.
-  //-------------------------------------------------------------------------
-  enum LayerEncodingType
-  {
-    TMX_ENCODING_XML,
-    TMX_ENCODING_BASE64,
-    TMX_ENCODING_CSV
-  };
-
-  //-------------------------------------------------------------------------
-  // Type used for the compression of the layer data.
-  //-------------------------------------------------------------------------
-  enum LayerCompressionType
-  {
-    TMX_COMPRESSION_NONE,
-    TMX_COMPRESSION_ZLIB,
-    TMX_COMPRESSION_GZIP
-  };
-
-  //-------------------------------------------------------------------------
-  // Used for storing information about the tile ids for every layer.
-  // This class also have a property set.
-  //-------------------------------------------------------------------------
-  class Layer
-  {
-  public:
-    Layer();
-    ~Layer();
-
-    // Parse a layer node.
-    void Parse(const TiXmlNode *layerNode);
-
-    // Get the name of the layer.
-    const std::string &GetName() const { return name; }
-
-    // Get the width of the layer, in tiles.
-    float GetWidth() const { return width; }
-
-    // Get the height of the layer, in tiles.
-    float GetHeight() const { return height; }
-
-    // Get the visibility of the layer
-    bool IsVisible() const { return visible; }
-
-    // Get the property set.
-    const PropertySet &GetProperties() const { return properties; }
-
-    // Pick a specific tile from the list.
-    unsigned GetTileGid(int x, int y) const { return tile_map[y * width + x].gid; }
-
-    // Get whether the tile is flipped horizontally.
-    bool IsTileFlippedHorizontally(int x, int y) const
-    { return tile_map[y * width + x].flippedHorizontally; }
-
-    // Get whether the tile is flipped vertically.
-    bool IsTileFlippedVertically(int x, int y) const
-    { return tile_map[y * width + x].flippedVertically; }
-
-    // Get whether the tile is flipped diagonally.
-    bool IsTileFlippedDiagonally(int x, int y) const
-    { return tile_map[y * width + x].flippedDiagonally; }
-
-    // Get the tile specific to the map.
-    MapTile GetTile(int x, int y) const { return tile_map[y * width + x]; }
-
-    // Get the type of encoding that was used for parsing the layer data.
-    // See: LayerEncodingType
-    LayerEncodingType GetEncoding() const { return encoding; }
-
-    // Get the type of compression that was used for parsing the layer data.
-    // See: LayerCompressionType
-    LayerCompressionType GetCompression() const { return compression; }
-
-  private:
-    void ParseXML(const TiXmlNode *dataNode);
-    void ParseBase64(const std::string &innerText);
-    void ParseCSV(const std::string &innerText);
-
-    std::string name;
-
-    int width;
-    int height;
-
-    float opacity;
-    bool visible;
-
-    PropertySet properties;
-
-    MapTile *tile_map;
-
-    LayerEncodingType encoding;
-    LayerCompressionType compression;
-  };
-};
+//-----------------------------------------------------------------------------
+// TmxLayer.h
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#pragma once
+
+#include <string>
+
+#include "TmxPropertySet.h"
+#include "TmxMapTile.h"
+
+class TiXmlNode;
+
+namespace Tmx 
+{
+	class Map;
+
+	//-------------------------------------------------------------------------
+	// Type used for the encoding of the layer data.
+	//-------------------------------------------------------------------------
+	enum LayerEncodingType 
+	{
+		TMX_ENCODING_XML,
+		TMX_ENCODING_BASE64,
+		TMX_ENCODING_CSV
+	};
+
+	//-------------------------------------------------------------------------
+	// Type used for the compression of the layer data.
+	//-------------------------------------------------------------------------
+	enum LayerCompressionType 
+	{
+		TMX_COMPRESSION_NONE,
+		TMX_COMPRESSION_ZLIB,
+		TMX_COMPRESSION_GZIP
+	};
+
+	//-------------------------------------------------------------------------
+	// Used for storing information about the tile ids for every layer.
+	// This class also have a property set.
+	//-------------------------------------------------------------------------
+	class Layer 
+	{
+	public:
+		Layer(const Tmx::Map *_map);
+		~Layer();
+
+		// Parse a layer node.
+		void Parse(const TiXmlNode *layerNode);
+
+		// Get the name of the layer.
+		const std::string &GetName() const { return name; }
+
+		// Get the width of the layer, in tiles.
+		int GetWidth() const { return width; }
+
+		// Get the height of the layer, in tiles.
+		int GetHeight() const { return height; }
+
+		// Get the visibility of the layer
+		bool IsVisible() const { return visible; }
+
+		// Get the property set.
+		const Tmx::PropertySet &GetProperties() const { return properties; }
+
+		// Pick a specific tile from the list.
+		unsigned GetTileId(int x, int y) const { return tile_map[y * width + x].id; }
+
+		// Get the tileset index for a tileset from the list.
+		int GetTileTilesetIndex(int x, int y) const { return tile_map[y * width + x].tilesetId; }
+
+		// Get whether a tile is flipped horizontally.
+		bool IsTileFlippedHorizontally(int x, int y) const 
+		{ return tile_map[y * width + x].flippedHorizontally; }
+
+		// Get whether a tile is flipped vertically.
+		bool IsTileFlippedVertically(int x, int y) const 
+		{ return tile_map[y * width + x].flippedVertically; }
+
+		// Get whether a tile is flipped diagonally.
+		bool IsTileFlippedDiagonally(int x, int y) const
+		{ return tile_map[y * width + x].flippedDiagonally; }
+
+		// Get a tile specific to the map.
+		const Tmx::MapTile& GetTile(int x, int y) const { return tile_map[y * width + x]; }
+
+		// Get the type of encoding that was used for parsing the layer data.
+		// See: LayerEncodingType
+		Tmx::LayerEncodingType GetEncoding() const { return encoding; }
+
+		// Get the type of compression that was used for parsing the layer data.
+		// See: LayerCompressionType
+		Tmx::LayerCompressionType GetCompression() const { return compression; }
+
+	private:
+		void ParseXML(const TiXmlNode *dataNode);
+		void ParseBase64(const std::string &innerText);
+		void ParseCSV(const std::string &innerText);
+
+		const Tmx::Map *map;
+
+		std::string name;
+		
+		int width;
+		int height;
+	
+		float opacity;
+		bool visible;
+
+		Tmx::PropertySet properties;
+
+		Tmx::MapTile *tile_map;
+
+		Tmx::LayerEncodingType encoding;
+		Tmx::LayerCompressionType compression;
+	};
+};
\ No newline at end of file
diff --git a/src/TMXParser/TmxMap.cpp b/src/TMXParser/TmxMap.cpp
index 426f039..10dd523 100644
--- a/src/TMXParser/TmxMap.cpp
+++ b/src/TMXParser/TmxMap.cpp
@@ -1,249 +1,266 @@
-//-----------------------------------------------------------------------------
-// TmxMap.cpp
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#include <cstdio>
-#include <tinyxml.h>
-
-#include "TmxMap.h"
-#include "TmxTileset.h"
-#include "TmxLayer.h"
-#include "TmxObjectGroup.h"
-
-using std::vector;
-using std::string;
-
-namespace Tmx 
-{
-	Map::Map() 
-		: file_name()
-		, file_path()
-		, version(0.0)
-		, orientation(TMX_MO_ORTHOGONAL)
-		, width(0)
-		, height(0)
-		, tile_width(0)
-		, tile_height(0)
-		, layers()
-		, object_groups()
-		, tilesets() 
-		, has_error(false)
-		, error_code(0)
-		, error_text()
-	{}
-
-	Map::~Map() 
-	{
-		// Iterate through all of the object groups and delete each of them.
-		vector< ObjectGroup* >::iterator ogIter;
-		for (ogIter = object_groups.begin(); ogIter != object_groups.end(); ++ogIter) 
-		{
-			ObjectGroup *objectGroup = (*ogIter);
-			
-			if (objectGroup)
-			{
-				delete objectGroup;
-				objectGroup = NULL;
-			}
-		}
-
-		// Iterate through all of the layers and delete each of them.
-		vector< Layer* >::iterator lIter;
-		for (lIter = layers.begin(); lIter != layers.end(); ++lIter) 
-		{
-			Layer *layer = (*lIter);
-
-			if (layer) 
-			{
-				delete layer;
-				layer = NULL;
-			}
-		}
-
-		// Iterate through all of the tilesets and delete each of them.
-		vector< Tileset* >::iterator tsIter;
-		for (tsIter = tilesets.begin(); tsIter != tilesets.end(); ++tsIter) 
-		{
-			Tileset *tileset = (*tsIter);
-			
-			if (tileset) 
-			{
-				delete tileset;
-				tileset = NULL;
-			}
-		}
-	}
-
-	void Map::ParseFile(const string &fileName) 
-	{
-		file_name = fileName;
-
-		int lastSlash = fileName.find_last_of("/");
-
-		// Get the directory of the file using substring.
-		if (lastSlash > 0) 
-		{
-			file_path = fileName.substr(0, lastSlash + 1);
-		} 
-		else 
-		{
-			file_path = "";
-		}
-
-		char* fileText;
-		int fileSize;
-
-		// Open the file for reading.
-		FILE *file = fopen(fileName.c_str(), "rb");
-
-		// Check if the file could not be opened.
-		if (!file) 
-		{
-			has_error = true;
-			error_code = TMX_COULDNT_OPEN;
-			error_text = "Could not open the file.";
-			return;
-		}
-		
-		// Find out the file size.
-		fseek(file, 0, SEEK_END);
-		fileSize = ftell(file);
-		fseek(file, 0, SEEK_SET);
-
-		// Allocate memory for the file and read it into the memory.
-		fileText = new char[fileSize];
-		fread(fileText, 1, fileSize, file);
-
-		fclose(file);
-
-		// Copy the contents into a C++ string and delete it from memory.
-		std::string text(fileText, fileText+fileSize);
-		delete [] fileText;
-
-		ParseText(text);		
-	}
-
-	void Map::ParseText(const string &text) 
-	{
-		// Create a tiny xml document and use it to parse the text.
-		TiXmlDocument doc;
-		doc.Parse(text.c_str());
-	
-		// Check for parsing errors.
-		if (doc.Error()) 
-		{
-			has_error = true;
-			error_code = TMX_PARSING_ERROR;
-			error_text = doc.ErrorDesc();
-			return;
-		}
-
-		TiXmlNode *mapNode = doc.FirstChild("map");
-		TiXmlElement* mapElem = mapNode->ToElement();
-
-		// Read the map attributes.
-		mapElem->Attribute("version", &version);
-		mapElem->Attribute("width", &width);
-		mapElem->Attribute("height", &height);
-		mapElem->Attribute("tilewidth", &tile_width);
-		mapElem->Attribute("tileheight", &tile_height);
-
-		// Read the orientation
-		std::string orientationStr = mapElem->Attribute("orientation");
-
-		if (!orientationStr.compare("orthogonal")) 
-		{
-			orientation = TMX_MO_ORTHOGONAL;
-		} 
-		else if (!orientationStr.compare("isometric")) 
-		{
-			orientation = TMX_MO_ISOMETRIC;
-		}
-
-		// Read the map properties.
-		const TiXmlNode *propertiesNode = mapElem->FirstChild("properties");
-		if (propertiesNode) 
-		{
-			properties.Parse(propertiesNode);
-		}
-
-		// Iterate through all of the tileset elements.
-		const TiXmlNode *tilesetNode = mapNode->FirstChild("tileset");
-		while (tilesetNode) 
-		{
-			// Allocate a new tileset and parse it.
-			Tileset *tileset = new Tileset();
-			tileset->Parse(tilesetNode->ToElement());
-
-			// Add the tileset to the list.
-			tilesets.push_back(tileset);
-
-			tilesetNode = mapNode->IterateChildren("tileset", tilesetNode);
-		}
-
-		// Iterate through all of the layer elements.
-		TiXmlNode *layerNode = mapNode->FirstChild("layer");
-		while (layerNode) 
-		{
-			// Allocate a new layer and parse it.
-			Layer *layer = new Layer();
-			layer->Parse(layerNode);
-
-			// Add the layer to the list.
-			layers.push_back(layer);
-
-			layerNode = mapNode->IterateChildren("layer", layerNode);
-		}
-
-		// Iterate through all of the objectgroup elements.
-		TiXmlNode *objectGroupNode = mapNode->FirstChild("objectgroup");
-		while (objectGroupNode) 
-		{
-			// Allocate a new object group and parse it.
-			ObjectGroup *objectGroup = new ObjectGroup();
-			objectGroup->Parse(objectGroupNode);
-		
-			// Add the object group to the list.
-			object_groups.push_back(objectGroup);
-
-			objectGroupNode = mapNode->IterateChildren("objectgroup", objectGroupNode);
-		}
-	}
-
-	const Tileset *Map::FindTileset(int gid) const 
-	{
-		for (int i = tilesets.size() - 1; i > -1; --i) 
-		{
-			// If the gid beyond the tileset gid return it.
-			if (gid >= tilesets[i]->GetFirstGid()) 
-			{
-				return tilesets[i];
-			}
-		}
-		
-		return NULL;
-	}
-};
\ No newline at end of file
+//-----------------------------------------------------------------------------
+// TmxMap.cpp
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#include <tinyxml.h>
+#include <stdio.h>
+
+#include "TmxMap.h"
+#include "TmxTileset.h"
+#include "TmxLayer.h"
+#include "TmxObjectGroup.h"
+
+using std::vector;
+using std::string;
+
+namespace Tmx 
+{
+	Map::Map() 
+		: file_name()
+		, file_path()
+		, version(0.0)
+		, orientation(TMX_MO_ORTHOGONAL)
+		, width(0)
+		, height(0)
+		, tile_width(0)
+		, tile_height(0)
+		, layers()
+		, object_groups()
+		, tilesets() 
+		, has_error(false)
+		, error_code(0)
+		, error_text()
+	{}
+
+	Map::~Map() 
+	{
+		// Iterate through all of the object groups and delete each of them.
+		vector< ObjectGroup* >::iterator ogIter;
+		for (ogIter = object_groups.begin(); ogIter != object_groups.end(); ++ogIter) 
+		{
+			ObjectGroup *objectGroup = (*ogIter);
+			
+			if (objectGroup)
+			{
+				delete objectGroup;
+				objectGroup = NULL;
+			}
+		}
+
+		// Iterate through all of the layers and delete each of them.
+		vector< Layer* >::iterator lIter;
+		for (lIter = layers.begin(); lIter != layers.end(); ++lIter) 
+		{
+			Layer *layer = (*lIter);
+
+			if (layer) 
+			{
+				delete layer;
+				layer = NULL;
+			}
+		}
+
+		// Iterate through all of the tilesets and delete each of them.
+		vector< Tileset* >::iterator tsIter;
+		for (tsIter = tilesets.begin(); tsIter != tilesets.end(); ++tsIter) 
+		{
+			Tileset *tileset = (*tsIter);
+			
+			if (tileset) 
+			{
+				delete tileset;
+				tileset = NULL;
+			}
+		}
+	}
+
+	void Map::ParseFile(const string &fileName) 
+	{
+		file_name = fileName;
+
+		int lastSlash = fileName.find_last_of("/");
+
+		// Get the directory of the file using substring.
+		if (lastSlash > 0) 
+		{
+			file_path = fileName.substr(0, lastSlash + 1);
+		} 
+		else 
+		{
+			file_path = "";
+		}
+
+		char* fileText;
+		int fileSize;
+
+		// Open the file for reading.
+		FILE *file = fopen(fileName.c_str(), "rb");
+
+		// Check if the file could not be opened.
+		if (!file) 
+		{
+			has_error = true;
+			error_code = TMX_COULDNT_OPEN;
+			error_text = "Could not open the file.";
+			return;
+		}
+		
+		// Find out the file size.
+		fseek(file, 0, SEEK_END);
+		fileSize = ftell(file);
+		fseek(file, 0, SEEK_SET);
+
+		// Allocate memory for the file and read it into the memory.
+		fileText = new char[fileSize];
+		fread(fileText, 1, fileSize, file);
+
+		fclose(file);
+
+		// Copy the contents into a C++ string and delete it from memory.
+		std::string text(fileText, fileText+fileSize);
+		delete [] fileText;
+
+		ParseText(text);		
+	}
+
+	void Map::ParseText(const string &text) 
+	{
+		// Create a tiny xml document and use it to parse the text.
+		TiXmlDocument doc;
+		doc.Parse(text.c_str());
+	
+		// Check for parsing errors.
+		if (doc.Error()) 
+		{
+			has_error = true;
+			error_code = TMX_PARSING_ERROR;
+			error_text = doc.ErrorDesc();
+			return;
+		}
+
+		TiXmlNode *mapNode = doc.FirstChild("map");
+		TiXmlElement* mapElem = mapNode->ToElement();
+
+		// Read the map attributes.
+		mapElem->Attribute("version", &version);
+		mapElem->Attribute("width", &width);
+		mapElem->Attribute("height", &height);
+		mapElem->Attribute("tilewidth", &tile_width);
+		mapElem->Attribute("tileheight", &tile_height);
+
+		// Read the orientation
+		std::string orientationStr = mapElem->Attribute("orientation");
+
+		if (!orientationStr.compare("orthogonal")) 
+		{
+			orientation = TMX_MO_ORTHOGONAL;
+		} 
+		else if (!orientationStr.compare("isometric")) 
+		{
+			orientation = TMX_MO_ISOMETRIC;
+		}
+
+		// Read the map properties.
+		const TiXmlNode *propertiesNode = mapElem->FirstChild("properties");
+		if (propertiesNode) 
+		{
+			properties.Parse(propertiesNode);
+		}
+
+		// Iterate through all of the tileset elements.
+		const TiXmlNode *tilesetNode = mapNode->FirstChild("tileset");
+		while (tilesetNode) 
+		{
+			// Allocate a new tileset and parse it.
+			Tileset *tileset = new Tileset();
+			tileset->Parse(tilesetNode->ToElement());
+
+			// Add the tileset to the list.
+			tilesets.push_back(tileset);
+
+			tilesetNode = mapNode->IterateChildren("tileset", tilesetNode);
+		}
+
+		// Iterate through all of the layer elements.
+		TiXmlNode *layerNode = mapNode->FirstChild("layer");
+		while (layerNode) 
+		{
+			// Allocate a new layer and parse it.
+			Layer *layer = new Layer(this);
+			layer->Parse(layerNode);
+
+			// Add the layer to the list.
+			layers.push_back(layer);
+
+			layerNode = mapNode->IterateChildren("layer", layerNode);
+		}
+
+		// Iterate through all of the objectgroup elements.
+		TiXmlNode *objectGroupNode = mapNode->FirstChild("objectgroup");
+		while (objectGroupNode) 
+		{
+			// Allocate a new object group and parse it.
+			ObjectGroup *objectGroup = new ObjectGroup();
+			objectGroup->Parse(objectGroupNode);
+		
+			// Add the object group to the list.
+			object_groups.push_back(objectGroup);
+
+			objectGroupNode = mapNode->IterateChildren("objectgroup", objectGroupNode);
+		}
+	}
+
+	int Map::FindTilesetIndex(int gid) const
+	{
+		// Clean up the flags from the gid (thanks marwes91).
+		gid &= ~(FlippedHorizontallyFlag | FlippedVerticallyFlag | FlippedDiagonallyFlag);
+
+		for (int i = tilesets.size() - 1; i > -1; --i) 
+		{
+			// If the gid beyond the tileset gid return its index.
+			if (gid >= tilesets[i]->GetFirstGid()) 
+			{
+				return i;
+			}
+		}
+		
+		return -1;
+	}
+
+	const Tileset *Map::FindTileset(int gid) const 
+	{
+		for (int i = tilesets.size() - 1; i > -1; --i) 
+		{
+			// If the gid beyond the tileset gid return it.
+			if (gid >= tilesets[i]->GetFirstGid()) 
+			{
+				return tilesets[i];
+			}
+		}
+		
+		return NULL;
+	}
+};
diff --git a/src/TMXParser/TmxMap.h b/src/TMXParser/TmxMap.h
index b0a52a2..f0e325c 100644
--- a/src/TMXParser/TmxMap.h
+++ b/src/TMXParser/TmxMap.h
@@ -1,172 +1,175 @@
-//-----------------------------------------------------------------------------
-// TmxMap.h
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#pragma once
-
-#include <vector>
-#include <string>
-
-#include "TmxPropertySet.h"
-
-namespace Tmx 
-{
-	class Layer;
-	class ObjectGroup;
-	class Tileset;
-
-	//-------------------------------------------------------------------------
-	// Error in handling of the Map class.
-	//-------------------------------------------------------------------------
-	enum MapError 
-	{
-		// A file could not be opened. (usually due to permission problems)
-		TMX_COULDNT_OPEN = 0x01,
-
-		// There was an error in parsing the TMX file.
-		// This is being caused by TinyXML parsing problems.
-		TMX_PARSING_ERROR = 0x02,
-	};
-
-	//-------------------------------------------------------------------------
-	// The way the map is viewed.
-	//-------------------------------------------------------------------------
-	enum MapOrientation 
-	{
-		// This map is an orthogonal map.
-		TMX_MO_ORTHOGONAL = 0x01,
-
-		// This map is an isometric map.
-		TMX_MO_ISOMETRIC = 0x02
-	};
-
-	//-------------------------------------------------------------------------
-	// This class is the root class of the parser.
-	// It has all of the information in regard to the TMX file.
-	// This class has a property set.
-	//-------------------------------------------------------------------------
-	class Map 
-	{
-	public:
-		Map();
-		~Map();
-
-		// Read a file and parse it.
-		// Note: use '/' instead of '\\' as it is using '/' to find the path.
-		void ParseFile(const std::string &fileName);
-		
-		// Parse text containing TMX formatted XML.
-		void ParseText(const std::string &text);
-
-		// Get the filename used to read the map.
-		const std::string &GetFilename() { return file_name; }
-
-		// Get a path to the directory of the map file if any.
-		const std::string &GetFilepath() const { return file_path; }
-
-		// Get the version of the map.
-		double GetVersion() const { return version; }
-
-		// Get the orientation of the map.
-		MapOrientation GetOrientation() const { return orientation; }
-
-		// Get the width of the map, in tiles.
-		int GetWidth() const { return width; }
-
-		// Get the height of the map, in tiles.
-		int GetHeight() const { return height; }
-
-		// Get the width of a tile, in pixels.
-		int GetTileWidth() const { return tile_width; }
-
-		// Get the height of a tile, in pixels.
-		int GetTileHeight() const { return tile_height; }
-
-		// Get the layer at a certain index.
-		const Layer *GetLayer(int index) const { return layers.at(index); }
-
-		// Get the amount of layers.
-		int GetNumLayers() const { return layers.size(); }
-
-		// Get the whole layers collection.
-		const std::vector< Layer* > &GetLayers() const { return layers; }
-
-		// Get the object group at a certain index.
-		const ObjectGroup *GetObjectGroup(int index) const { return object_groups.at(index); }
-
-		// Get the amount of object groups.
-		int GetNumObjectGroups() const { return object_groups.size(); }
-
-		// Get the whole object group collection.
-		const std::vector< ObjectGroup* > &GetObjectGroups() const { return object_groups; }
-
-		// Find a tileset for a specific gid.
-		const Tileset *FindTileset(int gid) const;
-
-		// Get a tileset by an index.
-		const Tileset *GetTileset(int index) const { return tilesets.at(index); }
-
-		// Get the amount of tilesets.
-		int GetNumTilesets() const { return tilesets.size(); }
-
-		// Get the collection of tilesets.
-		const std::vector< Tileset* > &GetTilesets() const { return tilesets; }
-
-		// Get whether there was an error or not.
-		bool HasError() const { return has_error; }
-
-		// Get an error string containing the error in text format.
-		const std::string &GetErrorText() const { return error_text; }
-
-		// Get a number that identifies the error. (TMX_ preceded constants)
-		unsigned char GetErrorCode() const { return error_code; }
-
-		// Get the property set.
-		const PropertySet &GetProperties() { return properties; }
-
-	private:
-		std::string file_name;
-		std::string file_path;
-
-		double version;
-		MapOrientation orientation;
-
-		int width;
-		int height;
-		int tile_width;
-		int tile_height;
-
-		std::vector< Layer* > layers;
-		std::vector< ObjectGroup* > object_groups;
-		std::vector< Tileset* > tilesets;
-
-		bool has_error;
-		unsigned char error_code;
-		std::string error_text;
-
-		PropertySet properties;
-	};
+//-----------------------------------------------------------------------------
+// TmxMap.h
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#pragma once
+
+#include <vector>
+#include <string>
+
+#include "TmxPropertySet.h"
+
+namespace Tmx 
+{
+	class Layer;
+	class ObjectGroup;
+	class Tileset;
+
+	//-------------------------------------------------------------------------
+	// Error in handling of the Map class.
+	//-------------------------------------------------------------------------
+	enum MapError 
+	{
+		// A file could not be opened. (usually due to permission problems)
+		TMX_COULDNT_OPEN = 0x01,
+
+		// There was an error in parsing the TMX file.
+		// This is being caused by TinyXML parsing problems.
+		TMX_PARSING_ERROR = 0x02,
+	};
+
+	//-------------------------------------------------------------------------
+	// The way the map is viewed.
+	//-------------------------------------------------------------------------
+	enum MapOrientation 
+	{
+		// This map is an orthogonal map.
+		TMX_MO_ORTHOGONAL = 0x01,
+
+		// This map is an isometric map.
+		TMX_MO_ISOMETRIC = 0x02
+	};
+
+	//-------------------------------------------------------------------------
+	// This class is the root class of the parser.
+	// It has all of the information in regard to the TMX file.
+	// This class has a property set.
+	//-------------------------------------------------------------------------
+	class Map 
+	{
+	public:
+		Map();
+		~Map();
+
+		// Read a file and parse it.
+		// Note: use '/' instead of '\\' as it is using '/' to find the path.
+		void ParseFile(const std::string &fileName);
+		
+		// Parse text containing TMX formatted XML.
+		void ParseText(const std::string &text);
+
+		// Get the filename used to read the map.
+		const std::string &GetFilename() { return file_name; }
+
+		// Get a path to the directory of the map file if any.
+		const std::string &GetFilepath() const { return file_path; }
+
+		// Get the version of the map.
+		double GetVersion() const { return version; }
+
+		// Get the orientation of the map.
+		Tmx::MapOrientation GetOrientation() const { return orientation; }
+
+		// Get the width of the map, in tiles.
+		int GetWidth() const { return width; }
+
+		// Get the height of the map, in tiles.
+		int GetHeight() const { return height; }
+
+		// Get the width of a tile, in pixels.
+		int GetTileWidth() const { return tile_width; }
+
+		// Get the height of a tile, in pixels.
+		int GetTileHeight() const { return tile_height; }
+
+		// Get the layer at a certain index.
+		const Tmx::Layer *GetLayer(int index) const { return layers.at(index); }
+
+		// Get the amount of layers.
+		int GetNumLayers() const { return layers.size(); }
+
+		// Get the whole layers collection.
+		const std::vector< Tmx::Layer* > &GetLayers() const { return layers; }
+
+		// Get the object group at a certain index.
+		const Tmx::ObjectGroup *GetObjectGroup(int index) const { return object_groups.at(index); }
+
+		// Get the amount of object groups.
+		int GetNumObjectGroups() const { return object_groups.size(); }
+
+		// Get the whole object group collection.
+		const std::vector< Tmx::ObjectGroup* > &GetObjectGroups() const { return object_groups; }
+
+		// Find the tileset index for a tileset using a tile gid.
+		int FindTilesetIndex(int gid) const;
+
+		// Find a tileset for a specific gid.
+		const Tmx::Tileset *FindTileset(int gid) const;
+
+		// Get a tileset by an index.
+		const Tmx::Tileset *GetTileset(int index) const { return tilesets.at(index); }
+
+		// Get the amount of tilesets.
+		int GetNumTilesets() const { return tilesets.size(); }
+
+		// Get the collection of tilesets.
+		const std::vector< Tmx::Tileset* > &GetTilesets() const { return tilesets; }
+
+		// Get whether there was an error or not.
+		bool HasError() const { return has_error; }
+
+		// Get an error string containing the error in text format.
+		const std::string &GetErrorText() const { return error_text; }
+
+		// Get a number that identifies the error. (TMX_ preceded constants)
+		unsigned char GetErrorCode() const { return error_code; }
+
+		// Get the property set.
+		const Tmx::PropertySet &GetProperties() { return properties; }
+
+	private:
+		std::string file_name;
+		std::string file_path;
+
+		double version;
+		Tmx::MapOrientation orientation;
+
+		int width;
+		int height;
+		int tile_width;
+		int tile_height;
+
+		std::vector< Tmx::Layer* > layers;
+		std::vector< Tmx::ObjectGroup* > object_groups;
+		std::vector< Tmx::Tileset* > tilesets;
+
+		bool has_error;
+		unsigned char error_code;
+		std::string error_text;
+
+		Tmx::PropertySet properties;
+	};
 };
\ No newline at end of file
diff --git a/src/TMXParser/TmxMapTile.h b/src/TMXParser/TmxMapTile.h
index 87a882b..6f75466 100644
--- a/src/TMXParser/TmxMapTile.h
+++ b/src/TMXParser/TmxMapTile.h
@@ -1,75 +1,80 @@
-//-----------------------------------------------------------------------------
-// TmxMapTile.h
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#pragma once
-
-namespace Tmx 
-{
-	//-------------------------------------------------------------------------
-	// Flags that may be in the first two bits of the gid.
-	//-------------------------------------------------------------------------
-	const unsigned FlippedHorizontallyFlag = 0x80000000;
-	const unsigned FlippedVerticallyFlag   = 0x40000000;
-	const unsigned FlippedDiagonallyFlag   = 0x20000000;
-
-	//-------------------------------------------------------------------------
-	// Struct to store information about a specific tile in the map layer.
-	//-------------------------------------------------------------------------
-	struct MapTile 
-	{
-		// Default constructor.
-		MapTile()
-			: gid(0)
-			, flippedHorizontally(false)
-			, flippedVertically(false)
-			, flippedDiagonally(false)
-		{}
-
-		// Will take a gid and read the attributes from the first
-		// two bits of it.
-		MapTile(unsigned _gid)
-			: gid(_gid)
-			, flippedHorizontally((_gid & FlippedHorizontallyFlag) != 0)
-			, flippedVertically((_gid & FlippedVerticallyFlag) != 0)
-			, flippedDiagonally((_gid & FlippedDiagonallyFlag) != 0)
-		{
-			gid &= ~(FlippedHorizontallyFlag | FlippedVerticallyFlag | FlippedDiagonallyFlag);
-		}
-
-		// Global id.
-		unsigned gid;
-
-		// True when the tile should be drawn flipped horizontally.
-		bool flippedHorizontally;
-
-		// True when the tile should be drawn flipped vertically.
-		bool flippedVertically;
-
-		// True when the tile should be drawn flipped diagonally.
-		bool flippedDiagonally;
-	};
+//-----------------------------------------------------------------------------
+// TmxMapTile.h
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#pragma once
+
+namespace Tmx 
+{
+	//-------------------------------------------------------------------------
+	// Flags that may be in the first two bits of the gid.
+	//-------------------------------------------------------------------------
+	const unsigned FlippedHorizontallyFlag = 0x80000000;
+	const unsigned FlippedVerticallyFlag   = 0x40000000;
+	const unsigned FlippedDiagonallyFlag   = 0x20000000;
+
+	//-------------------------------------------------------------------------
+	// Struct to store information about a specific tile in the map layer.
+	//-------------------------------------------------------------------------
+	struct MapTile 
+	{
+		// Default constructor.
+		MapTile()
+			: tilesetId(0)
+			, id(0)
+			, flippedHorizontally(false)
+			, flippedVertically(false)
+			, flippedDiagonally(false)
+		{}
+
+		// Will take a gid and read the attributes from the first
+		// two bits of it.
+		MapTile(unsigned _gid, int _tilesetFirstGid, unsigned _tilesetId)
+			: tilesetId(_tilesetId)
+			, id(_gid & ~(FlippedHorizontallyFlag | FlippedVerticallyFlag | FlippedDiagonallyFlag))
+			, flippedHorizontally((_gid & FlippedHorizontallyFlag) != 0)
+			, flippedVertically((_gid & FlippedVerticallyFlag) != 0)
+			, flippedDiagonally((_gid & FlippedDiagonallyFlag) != 0)
+		{
+			id -= _tilesetFirstGid;
+		}
+
+		// Tileset id.
+		int tilesetId;
+
+		// Id.
+		unsigned id;
+
+		// True when the tile should be drawn flipped horizontally.
+		bool flippedHorizontally;
+
+		// True when the tile should be drawn flipped vertically.
+		bool flippedVertically;
+
+		// True when the tile should be drawn flipped diagonally.
+		bool flippedDiagonally;
+	};
 };
\ No newline at end of file
diff --git a/src/TMXParser/TmxObject.cpp b/src/TMXParser/TmxObject.cpp
index 42e657b..7573ff7 100644
--- a/src/TMXParser/TmxObject.cpp
+++ b/src/TMXParser/TmxObject.cpp
@@ -1,107 +1,107 @@
-//-----------------------------------------------------------------------------
-// TmxObject.cpp
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#include <tinyxml.h>
-
-#include "TmxObject.h"
-#include "TmxPolygon.h"
-#include "TmxPolyline.h"
-
-namespace Tmx 
-{
-	Object::Object() 
-		: name()
-		, type()
-		, x(0)
-		, y(0)
-		, width(0)
-		, height(0)
-		, gid(0)
-		, polygon(0)
-		, polyline(0)
-		, properties() 
-	{}
-
-	Object::~Object() 
-	{
-		if (polygon != 0)
-		{
-			delete polygon;
-			polygon = 0;
-		}
-		if (polyline != 0)
-		{
-			delete polyline;
-			polyline = 0;
-		}
-	}
-
-	void Object::Parse(const TiXmlNode *objectNode) 
-	{
-		const TiXmlElement *objectElem = objectNode->ToElement();
-
-		// Read the attributes of the object.
-		const char *tempName = objectElem->Attribute("name");
-		const char *tempType = objectElem->Attribute("type");
-		
-		if (tempName) name = tempName;
-		if (tempType) type = tempType;
-		
-		objectElem->Attribute("x", &x);
-		objectElem->Attribute("y", &y);
-		objectElem->Attribute("width", &width);
-		objectElem->Attribute("height", &height);
-		objectElem->Attribute("gid", &gid);
-
-		// Read the Polygon and Polyline of the object if there are any.
-		const TiXmlNode *polygonNode = objectNode->FirstChild("polygon");
-		if (polygonNode)
-		{
-			if (polygon != 0)
-				delete polygon;
-
-			polygon = new Polygon();
-			polygon->Parse(polygonNode);
-		}
-		const TiXmlNode *polylineNode = objectNode->FirstChild("polyline");
-		if (polylineNode)
-		{
-			if (polyline != 0)
-				delete polyline;
-
-			polyline = new Polyline();
-			polyline->Parse(polylineNode);
-		}
-
-		// Read the properties of the object.
-		const TiXmlNode *propertiesNode = objectNode->FirstChild("properties");
-		if (propertiesNode) 
-		{
-			properties.Parse(propertiesNode);
-		}
-	}
-};
\ No newline at end of file
+//-----------------------------------------------------------------------------
+// TmxObject.cpp
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#include <tinyxml.h>
+
+#include "TmxObject.h"
+#include "TmxPolygon.h"
+#include "TmxPolyline.h"
+
+namespace Tmx 
+{
+	Object::Object() 
+		: name()
+		, type()
+		, x(0)
+		, y(0)
+		, width(0)
+		, height(0)
+		, gid(0)
+		, polygon(0)
+		, polyline(0)
+		, properties() 
+	{}
+
+	Object::~Object() 
+	{
+		if (polygon != 0)
+		{
+			delete polygon;
+			polygon = 0;
+		}
+		if (polyline != 0)
+		{
+			delete polyline;
+			polyline = 0;
+		}
+	}
+
+	void Object::Parse(const TiXmlNode *objectNode) 
+	{
+		const TiXmlElement *objectElem = objectNode->ToElement();
+
+		// Read the attributes of the object.
+		const char *tempName = objectElem->Attribute("name");
+		const char *tempType = objectElem->Attribute("type");
+		
+		if (tempName) name = tempName;
+		if (tempType) type = tempType;
+		
+		objectElem->Attribute("x", &x);
+		objectElem->Attribute("y", &y);
+		objectElem->Attribute("width", &width);
+		objectElem->Attribute("height", &height);
+		objectElem->Attribute("gid", &gid);
+
+		// Read the Polygon and Polyline of the object if there are any.
+		const TiXmlNode *polygonNode = objectNode->FirstChild("polygon");
+		if (polygonNode)
+		{
+			if (polygon != 0)
+				delete polygon;
+
+			polygon = new Polygon();
+			polygon->Parse(polygonNode);
+		}
+		const TiXmlNode *polylineNode = objectNode->FirstChild("polyline");
+		if (polylineNode)
+		{
+			if (polyline != 0)
+				delete polyline;
+
+			polyline = new Polyline();
+			polyline->Parse(polylineNode);
+		}
+
+		// Read the properties of the object.
+		const TiXmlNode *propertiesNode = objectNode->FirstChild("properties");
+		if (propertiesNode) 
+		{
+			properties.Parse(propertiesNode);
+		}
+	}
+};
diff --git a/src/TMXParser/TmxObject.h b/src/TMXParser/TmxObject.h
index 6e280fc..3f59c39 100644
--- a/src/TMXParser/TmxObject.h
+++ b/src/TMXParser/TmxObject.h
@@ -1,98 +1,98 @@
-//-----------------------------------------------------------------------------
-// TmxObject.h
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#pragma once
-
-#include <string>
-
-#include "TmxPropertySet.h"
-
-class TiXmlNode;
-
-namespace Tmx 
-{
-	class Polygon;
-	class Polyline;
-
-	//-------------------------------------------------------------------------
-	// Class used for representing a single object from the objectgroup.
-	//-------------------------------------------------------------------------
-	class Object 
-	{
-	public:
-		Object();
-		~Object();
-
-		// Parse an object node.
-		void Parse(const TiXmlNode *objectNode);
-	
-		// Get the name of the object.
-		const std::string &GetName() const { return name; }
-		
-		// Get the type of the object.
-		const std::string &GetType() const { return type; }
-
-		// Get the left side of the object, in pixels.
-		int GetX() const { return x; }
-
-		// Get the top side of the object, in pixels.
-		int GetY() const { return y; }
-		
-		// Get the width of the object, in pixels.
-		int GetWidth() const { return width; }
-		
-		// Get the height of the object, in pixels.
-		int GetHeight() const { return height; }
-
-		// Get the Global ID of the tile associated with this object.
-		int GetGid() const { return gid; }
-
-		// Get the Polygon.
-		const Polygon *GetPolygon() const { return polygon; }
-
-		// Get the Polyline.
-		const Polyline *GetPolyline() const { return polyline; }
-
-		// Get the property set.
-		const PropertySet &GetProperties() const { return properties; }
-
-	private:
-		std::string name;
-		std::string type;
-
-		int x;
-		int y;
-		int width;
-		int height;
-		int gid;
-
-		Polygon *polygon;
-		Polyline *polyline;
-
-		PropertySet properties;
-	};
+//-----------------------------------------------------------------------------
+// TmxObject.h
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#pragma once
+
+#include <string>
+
+#include "TmxPropertySet.h"
+
+class TiXmlNode;
+
+namespace Tmx 
+{
+	class Polygon;
+	class Polyline;
+
+	//-------------------------------------------------------------------------
+	// Class used for representing a single object from the objectgroup.
+	//-------------------------------------------------------------------------
+	class Object 
+	{
+	public:
+		Object();
+		~Object();
+
+		// Parse an object node.
+		void Parse(const TiXmlNode *objectNode);
+	
+		// Get the name of the object.
+		const std::string &GetName() const { return name; }
+		
+		// Get the type of the object.
+		const std::string &GetType() const { return type; }
+
+		// Get the left side of the object, in pixels.
+		int GetX() const { return x; }
+
+		// Get the top side of the object, in pixels.
+		int GetY() const { return y; }
+		
+		// Get the width of the object, in pixels.
+		int GetWidth() const { return width; }
+		
+		// Get the height of the object, in pixels.
+		int GetHeight() const { return height; }
+
+		// Get the Global ID of the tile associated with this object.
+		int GetGid() const { return gid; }
+
+		// Get the Polygon.
+		const Tmx::Polygon *GetPolygon() const { return polygon; }
+
+		// Get the Polyline.
+		const Tmx::Polyline *GetPolyline() const { return polyline; }
+
+		// Get the property set.
+		const Tmx::PropertySet &GetProperties() const { return properties; }
+
+	private:
+		std::string name;
+		std::string type;
+
+		int x;
+		int y;
+		int width;
+		int height;
+		int gid;
+
+		Tmx::Polygon *polygon;
+		Tmx::Polyline *polyline;
+
+		Tmx::PropertySet properties;
+	};
 };
\ No newline at end of file
diff --git a/src/TMXParser/TmxObjectGroup.cpp b/src/TMXParser/TmxObjectGroup.cpp
index a2be45e..5d1eb2b 100644
--- a/src/TMXParser/TmxObjectGroup.cpp
+++ b/src/TMXParser/TmxObjectGroup.cpp
@@ -1,76 +1,76 @@
-//-----------------------------------------------------------------------------
-// TmxObjectGroup.cpp
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#include <tinyxml.h>
-
-#include "TmxObjectGroup.h"
-#include "TmxObject.h"
-
-namespace Tmx 
-{
-	ObjectGroup::ObjectGroup()
-		: name()
-		, width(0)
-		, height(0)
-	{}
-
-	ObjectGroup::~ObjectGroup() 
-	{
-		for(std::size_t i = 0; i < objects.size(); i++)
-		{
-			Object *obj = objects.at(i);
-			delete obj;
-		}
-	}
-
-	void ObjectGroup::Parse(const TiXmlNode *objectGroupNode) 
-	{
-		const TiXmlElement *objectGroupElem = objectGroupNode->ToElement();
-
-		// Read the object group attributes.
-		name = objectGroupElem->Attribute("name");
-		
-		objectGroupElem->Attribute("width", &width);
-		objectGroupElem->Attribute("height", &height);
-		objectGroupElem->Attribute("visible", &visible);
-
-		// Iterate through all of the object elements.
-		const TiXmlNode *objectNode = objectGroupNode->FirstChild("object");
-		while (objectNode) 
-		{
-			// Allocate a new object and parse it.
-			Object *object = new Object();
-			object->Parse(objectNode);
-			
-			// Add the object to the list.
-			objects.push_back(object);
-
-			objectNode = objectGroupNode->IterateChildren("object", objectNode);
-		}
-	}
-
-};
\ No newline at end of file
+//-----------------------------------------------------------------------------
+// TmxObjectGroup.cpp
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#include <tinyxml.h>
+
+#include "TmxObjectGroup.h"
+#include "TmxObject.h"
+
+namespace Tmx 
+{
+	ObjectGroup::ObjectGroup()
+		: name()
+		, width(0)
+		, height(0)
+	{}
+
+	ObjectGroup::~ObjectGroup() 
+	{
+		for(std::size_t i = 0; i < objects.size(); i++)
+		{
+			Object *obj = objects.at(i);
+			delete obj;
+		}
+	}
+
+	void ObjectGroup::Parse(const TiXmlNode *objectGroupNode) 
+	{
+		const TiXmlElement *objectGroupElem = objectGroupNode->ToElement();
+
+		// Read the object group attributes.
+		name = objectGroupElem->Attribute("name");
+		
+		objectGroupElem->Attribute("width", &width);
+		objectGroupElem->Attribute("height", &height);
+		objectGroupElem->Attribute("visible", &visible);
+
+		// Iterate through all of the object elements.
+		const TiXmlNode *objectNode = objectGroupNode->FirstChild("object");
+		while (objectNode) 
+		{
+			// Allocate a new object and parse it.
+			Object *object = new Object();
+			object->Parse(objectNode);
+			
+			// Add the object to the list.
+			objects.push_back(object);
+
+			objectNode = objectGroupNode->IterateChildren("object", objectNode);
+		}
+	}
+
+};
diff --git a/src/TMXParser/TmxObjectGroup.h b/src/TMXParser/TmxObjectGroup.h
index 7a3558b..7a4c37c 100644
--- a/src/TMXParser/TmxObjectGroup.h
+++ b/src/TMXParser/TmxObjectGroup.h
@@ -1,84 +1,84 @@
-//-----------------------------------------------------------------------------
-// TmxObjectGroup.h
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#pragma once
-
-#include <string>
-#include <vector>
-
-class TiXmlNode;
-
-namespace Tmx 
-{
-	class Object;
-	
-	//-------------------------------------------------------------------------
-	// A class used for holding a list of objects.
-	// This class doesn't have a property set.
-	//-------------------------------------------------------------------------
-	class ObjectGroup 
-	{
-	public:
-		ObjectGroup();
-		~ObjectGroup();
-
-		// Parse an objectgroup node.
-		void Parse(const TiXmlNode *objectGroupNode);
-
-		// Get the name of the object group.
-		const std::string &GetName() const { return name; }
-
-		// Get the width of the object group, in pixels.
-		// Note: do not rely on this due to temporary bug in tiled.
-		int GetWidth() const { return width; }
-
-		// Get the height of the object group, in pixels.
-		// Note: do not rely on this due to temporary bug in tiled.
-		int GetHeight() const { return height; }
-
-		// Get a single object.
-		const Object *GetObject(int index) const { return objects.at(index); }
-
-		// Get the number of objects in the list.
-		int GetNumObjects() const { return objects.size(); }
-
-		// Get whether the object layer is visible.
-		int GetVisibility() const { return visible; }
-
-		// Get the whole list of objects.
-		const std::vector< Object* > &GetObjects() const { return objects; }
-
-	private:
-		std::string name;
-		
-		int width;
-		int height;
-		int visible;
-
-		std::vector< Object* > objects;
-	};
+//-----------------------------------------------------------------------------
+// TmxObjectGroup.h
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#pragma once
+
+#include <string>
+#include <vector>
+
+class TiXmlNode;
+
+namespace Tmx 
+{
+	class Object;
+	
+	//-------------------------------------------------------------------------
+	// A class used for holding a list of objects.
+	// This class doesn't have a property set.
+	//-------------------------------------------------------------------------
+	class ObjectGroup 
+	{
+	public:
+		ObjectGroup();
+		~ObjectGroup();
+
+		// Parse an objectgroup node.
+		void Parse(const TiXmlNode *objectGroupNode);
+
+		// Get the name of the object group.
+		const std::string &GetName() const { return name; }
+
+		// Get the width of the object group, in pixels.
+		// Note: do not rely on this due to temporary bug in tiled.
+		int GetWidth() const { return width; }
+
+		// Get the height of the object group, in pixels.
+		// Note: do not rely on this due to temporary bug in tiled.
+		int GetHeight() const { return height; }
+
+		// Get a single object.
+		const Tmx::Object *GetObject(int index) const { return objects.at(index); }
+
+		// Get the number of objects in the list.
+		int GetNumObjects() const { return objects.size(); }
+
+		// Get whether the object layer is visible.
+		int GetVisibility() const { return visible; }
+
+		// Get the whole list of objects.
+		const std::vector< Tmx::Object* > &GetObjects() const { return objects; }
+
+	private:
+		std::string name;
+		
+		int width;
+		int height;
+		int visible;
+
+		std::vector< Tmx::Object* > objects;
+	};
 };
\ No newline at end of file
diff --git a/src/TMXParser/TmxPoint.h b/src/TMXParser/TmxPoint.h
index ebf596e..777f62f 100644
--- a/src/TMXParser/TmxPoint.h
+++ b/src/TMXParser/TmxPoint.h
@@ -1,40 +1,40 @@
-//-----------------------------------------------------------------------------
-// TmxPoint.h
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#pragma once
-
-namespace Tmx
-{
-	//-------------------------------------------------------------------------
-	// Used to store a vertex of a Polygon/Polyline.
-	//-------------------------------------------------------------------------
-	struct Point
-	{
-		int x;
-		int y;
-	};
+//-----------------------------------------------------------------------------
+// TmxPoint.h
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#pragma once
+
+namespace Tmx
+{
+	//-------------------------------------------------------------------------
+	// Used to store a vertex of a Polygon/Polyline.
+	//-------------------------------------------------------------------------
+	struct Point
+	{
+		int x;
+		int y;
+	};
 }
\ No newline at end of file
diff --git a/src/TMXParser/TmxPolygon.cpp b/src/TMXParser/TmxPolygon.cpp
index 95137c8..ad28520 100644
--- a/src/TMXParser/TmxPolygon.cpp
+++ b/src/TMXParser/TmxPolygon.cpp
@@ -1,56 +1,56 @@
-//-----------------------------------------------------------------------------
-// TmxPolygon.cpp
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#include <tinyxml.h>
-
-#include "TmxPolygon.h"
-
-namespace Tmx 
-{
-	Polygon::Polygon()
-		: points()
-	{
-	}
-
-	void Polygon::Parse(const TiXmlNode *polygonNode)
-	{
-		char *pointsLine = strdup(polygonNode->ToElement()->Attribute("points"));
-		
-		char *token = strtok(pointsLine, " ");
-		while (token)
-		{
-			Point point;
-			sscanf(token, "%d,%d", &point.x, &point.y);
-
-			points.push_back(point);
-
-			token = strtok(0, " ");
-		}
-
-		free(pointsLine);
-	}
-}
\ No newline at end of file
+//-----------------------------------------------------------------------------
+// TmxPolygon.cpp
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#include <tinyxml.h>
+
+#include "TmxPolygon.h"
+
+namespace Tmx 
+{
+	Polygon::Polygon()
+		: points()
+	{
+	}
+
+	void Polygon::Parse(const TiXmlNode *polygonNode)
+	{
+		char *pointsLine = strdup(polygonNode->ToElement()->Attribute("points"));
+		
+		char *token = strtok(pointsLine, " ");
+		while (token)
+		{
+			Point point;
+			sscanf(token, "%d,%d", &point.x, &point.y);
+
+			points.push_back(point);
+
+			token = strtok(0, " ");
+		}
+
+		free(pointsLine);
+	}
+}
diff --git a/src/TMXParser/TmxPolygon.h b/src/TMXParser/TmxPolygon.h
index 5aee328..304dacf 100644
--- a/src/TMXParser/TmxPolygon.h
+++ b/src/TMXParser/TmxPolygon.h
@@ -1,58 +1,58 @@
-//-----------------------------------------------------------------------------
-// TmxPolygon.h
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#pragma once
-
-#include <vector>
-
-#include "TmxPoint.h"
-
-class TiXmlNode;
-
-namespace Tmx
-{
-	//-------------------------------------------------------------------------
-	// Class to store a Polygon of an Object.
-	//-------------------------------------------------------------------------
-	class Polygon
-	{
-	public:
-		Polygon();
-
-		// Parse the polygon node.
-		void Parse(const TiXmlNode *polygonNode);
-
-		// Get one of the vertices.
-		const Point &GetPoint(int index) const { return points[index]; }
-
-		// Get the number of vertices.
-		int GetNumPoints() const { return points.size(); }
-
-	private:
-		std::vector< Point > points;
-	};
+//-----------------------------------------------------------------------------
+// TmxPolygon.h
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#pragma once
+
+#include <vector>
+
+#include "TmxPoint.h"
+
+class TiXmlNode;
+
+namespace Tmx
+{
+	//-------------------------------------------------------------------------
+	// Class to store a Polygon of an Object.
+	//-------------------------------------------------------------------------
+	class Polygon
+	{
+	public:
+		Polygon();
+
+		// Parse the polygon node.
+		void Parse(const TiXmlNode *polygonNode);
+
+		// Get one of the vertices.
+		const Tmx::Point &GetPoint(int index) const { return points[index]; }
+
+		// Get the number of vertices.
+		int GetNumPoints() const { return points.size(); }
+
+	private:
+		std::vector< Tmx::Point > points;
+	};
 };
\ No newline at end of file
diff --git a/src/TMXParser/TmxPolyline.cpp b/src/TMXParser/TmxPolyline.cpp
index c39662d..e41efdb 100644
--- a/src/TMXParser/TmxPolyline.cpp
+++ b/src/TMXParser/TmxPolyline.cpp
@@ -1,56 +1,56 @@
-//-----------------------------------------------------------------------------
-// TmxPolyline.cpp
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#include <tinyxml.h>
-
-#include "TmxPolyline.h"
-
-namespace Tmx 
-{
-	Polyline::Polyline()
-		: points()
-	{
-	}
-
-	void Polyline::Parse(const TiXmlNode *polylineNode)
-	{
-		char *pointsLine = strdup(polylineNode->ToElement()->Attribute("points"));
-		
-		char *token = strtok(pointsLine, " ");
-		while (token)
-		{
-			Point point;
-			sscanf(token, "%d,%d", &point.x, &point.y);
-
-			points.push_back(point);
-
-			token = strtok(0, " ");
-		}
-
-		free(pointsLine);
-	}
-}
\ No newline at end of file
+//-----------------------------------------------------------------------------
+// TmxPolyline.cpp
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#include <tinyxml.h>
+
+#include "TmxPolyline.h"
+
+namespace Tmx 
+{
+	Polyline::Polyline()
+		: points()
+	{
+	}
+
+	void Polyline::Parse(const TiXmlNode *polylineNode)
+	{
+		char *pointsLine = strdup(polylineNode->ToElement()->Attribute("points"));
+		
+		char *token = strtok(pointsLine, " ");
+		while (token)
+		{
+			Point point;
+			sscanf(token, "%d,%d", &point.x, &point.y);
+
+			points.push_back(point);
+
+			token = strtok(0, " ");
+		}
+
+		free(pointsLine);
+	}
+}
diff --git a/src/TMXParser/TmxPolyline.h b/src/TMXParser/TmxPolyline.h
index b7effc2..7129f96 100644
--- a/src/TMXParser/TmxPolyline.h
+++ b/src/TMXParser/TmxPolyline.h
@@ -1,58 +1,58 @@
-//-----------------------------------------------------------------------------
-// TmxPolyline.h
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#pragma once
-
-#include <vector>
-
-#include "TmxPoint.h"
-
-class TiXmlNode;
-
-namespace Tmx
-{
-	//-------------------------------------------------------------------------
-	// Class to store a Polyline of an Object.
-	//-------------------------------------------------------------------------
-	class Polyline
-	{
-	public:
-		Polyline();
-
-		// Parse the polyline node.
-		void Parse(const TiXmlNode *polylineNode);
-
-		// Get one of the vertices.
-		const Point &GetPoint(int index) const { return points[index]; }
-
-		// Get the number of vertices.
-		int GetNumPoints() const { return points.size(); }
-
-	private:
-		std::vector< Point > points;
-	};
+//-----------------------------------------------------------------------------
+// TmxPolyline.h
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#pragma once
+
+#include <vector>
+
+#include "TmxPoint.h"
+
+class TiXmlNode;
+
+namespace Tmx
+{
+	//-------------------------------------------------------------------------
+	// Class to store a Polyline of an Object.
+	//-------------------------------------------------------------------------
+	class Polyline
+	{
+	public:
+		Polyline();
+
+		// Parse the polyline node.
+		void Parse(const TiXmlNode *polylineNode);
+
+		// Get one of the vertices.
+		const Tmx::Point &GetPoint(int index) const { return points[index]; }
+
+		// Get the number of vertices.
+		int GetNumPoints() const { return points.size(); }
+
+	private:
+		std::vector< Tmx::Point > points;
+	};
 };
\ No newline at end of file
diff --git a/src/TMXParser/TmxPropertySet.cpp b/src/TMXParser/TmxPropertySet.cpp
index 395dc78..d92b825 100644
--- a/src/TMXParser/TmxPropertySet.cpp
+++ b/src/TMXParser/TmxPropertySet.cpp
@@ -1,78 +1,78 @@
-//-----------------------------------------------------------------------------
-// TmxPropertySet.cpp
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#include <tinyxml.h>
-
-#include "TmxPropertySet.h"
-
-using std::string;
-using std::map;
-
-namespace Tmx 
-{
-		
-	PropertySet::PropertySet() : properties()  
-	{}
-
-	void PropertySet::Parse(const TiXmlNode *propertiesNode) 
-	{
-		// Iterate through all of the property nodes.
-		const TiXmlNode *propertyNode = propertiesNode->FirstChild("property");
-		string propertyName;
-		string propertyValue;
-
-		while (propertyNode) 
-		{
-			const TiXmlElement* propertyElem = propertyNode->ToElement();
-
-			// Read the attributes of the property and add it to the map
-			propertyName = string(propertyElem->Attribute("name"));
-			propertyValue = string(propertyElem->Attribute("value"));
-			properties[propertyName] = propertyValue;
-			
-			propertyNode = propertiesNode->IterateChildren(
-				"property", propertyNode);
-		}
-	}
-
-	string PropertySet::GetLiteralProperty(const string &name) const 
-	{
-		// Find the property in the map.
-		map< string, string >::const_iterator iter = properties.find(name);
-
-		if (iter == properties.end())
-			return std::string("No such property!");
-
-		return iter->second;
-	}
-
-	int PropertySet::GetNumericProperty(const string &name) const 
-	{
-		return atoi(GetLiteralProperty(name).c_str());
-	}
-
-};
+//-----------------------------------------------------------------------------
+// TmxPropertySet.cpp
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#include <tinyxml.h>
+
+#include "TmxPropertySet.h"
+
+using std::string;
+using std::map;
+
+namespace Tmx 
+{
+		
+	PropertySet::PropertySet() : properties()  
+	{}
+
+	void PropertySet::Parse(const TiXmlNode *propertiesNode) 
+	{
+		// Iterate through all of the property nodes.
+		const TiXmlNode *propertyNode = propertiesNode->FirstChild("property");
+		string propertyName;
+		string propertyValue;
+
+		while (propertyNode) 
+		{
+			const TiXmlElement* propertyElem = propertyNode->ToElement();
+
+			// Read the attributes of the property and add it to the map
+			propertyName = string(propertyElem->Attribute("name"));
+			propertyValue = string(propertyElem->Attribute("value"));
+			properties[propertyName] = propertyValue;
+			
+			propertyNode = propertiesNode->IterateChildren(
+				"property", propertyNode);
+		}
+	}
+
+	string PropertySet::GetLiteralProperty(const string &name) const 
+	{
+		// Find the property in the map.
+		map< string, string >::const_iterator iter = properties.find(name);
+
+		if (iter == properties.end())
+			return std::string("No such property!");
+
+		return iter->second;
+	}
+
+	int PropertySet::GetNumericProperty(const string &name) const 
+	{
+		return atoi(GetLiteralProperty(name).c_str());
+	}
+
+};
diff --git a/src/TMXParser/TmxPropertySet.h b/src/TMXParser/TmxPropertySet.h
index 31810c0..5925b2c 100644
--- a/src/TMXParser/TmxPropertySet.h
+++ b/src/TMXParser/TmxPropertySet.h
@@ -1,68 +1,68 @@
-//-----------------------------------------------------------------------------
-// TmxPropertySet.h
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#pragma once
-
-#include <map>
-#include <string>
-
-class TiXmlNode;
-
-namespace Tmx 
-{
-	//-----------------------------------------------------------------------------
-	// This class contains a map of properties.
-	//-----------------------------------------------------------------------------
-	class PropertySet 
-	{
-	public:
-		PropertySet();
-
-		// Parse a node containing all the property nodes.
-		void Parse(const TiXmlNode *propertiesNode);
-	
-		// Get a numeric property (integer).
-		int GetNumericProperty(const std::string &name) const;
-
-		// Get a literal property (string).
-		std::string GetLiteralProperty(const std::string &name) const;
-
-		// Returns the amount of properties.
-		int GetSize() const { return properties.size(); }
-
-		// Returns the STL map of the properties.
-		std::map< std::string, std::string > GetList() const 
-		{ return properties; }
-
-		// Returns whether there are no properties.
-		bool Empty() const { return properties.empty(); }
-
-	private:
-		std::map< std::string, std::string > properties;
-
-	};
+//-----------------------------------------------------------------------------
+// TmxPropertySet.h
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#pragma once
+
+#include <map>
+#include <string>
+
+class TiXmlNode;
+
+namespace Tmx 
+{
+	//-----------------------------------------------------------------------------
+	// This class contains a map of properties.
+	//-----------------------------------------------------------------------------
+	class PropertySet 
+	{
+	public:
+		PropertySet();
+
+		// Parse a node containing all the property nodes.
+		void Parse(const TiXmlNode *propertiesNode);
+	
+		// Get a numeric property (integer).
+		int GetNumericProperty(const std::string &name) const;
+
+		// Get a literal property (string).
+		std::string GetLiteralProperty(const std::string &name) const;
+
+		// Returns the amount of properties.
+		int GetSize() const { return properties.size(); }
+
+		// Returns the STL map of the properties.
+		std::map< std::string, std::string > GetList() const 
+		{ return properties; }
+
+		// Returns whether there are no properties.
+		bool Empty() const { return properties.empty(); }
+
+	private:
+		std::map< std::string, std::string > properties;
+
+	};
 };
\ No newline at end of file
diff --git a/src/TMXParser/TmxTile.cpp b/src/TMXParser/TmxTile.cpp
index 7c45fce..1fcd8c3 100644
--- a/src/TMXParser/TmxTile.cpp
+++ b/src/TMXParser/TmxTile.cpp
@@ -1,55 +1,55 @@
-//-----------------------------------------------------------------------------
-// TmxTile.cpp
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#include <tinyxml.h>
-
-#include "TmxTile.h"
-
-namespace Tmx 
-{
-	Tile::Tile() : properties()
-	{}
-
-	Tile::~Tile() 
-	{}
-
-	void Tile::Parse(const TiXmlNode *tileNode) 
-	{
-		const TiXmlElement *tileElem = tileNode->ToElement();
-
-		// Parse the attributes.
-		tileElem->Attribute("id", &id);
-
-		// Parse the properties if any.
-		const TiXmlNode *propertiesNode = tileNode->FirstChild("properties");
-		
-		if (propertiesNode) 
-		{
-			properties.Parse(propertiesNode);
-		}
-	}
-};
\ No newline at end of file
+//-----------------------------------------------------------------------------
+// TmxTile.cpp
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#include <tinyxml.h>
+
+#include "TmxTile.h"
+
+namespace Tmx 
+{
+	Tile::Tile() : properties()
+	{}
+
+	Tile::~Tile() 
+	{}
+
+	void Tile::Parse(const TiXmlNode *tileNode) 
+	{
+		const TiXmlElement *tileElem = tileNode->ToElement();
+
+		// Parse the attributes.
+		tileElem->Attribute("id", &id);
+
+		// Parse the properties if any.
+		const TiXmlNode *propertiesNode = tileNode->FirstChild("properties");
+		
+		if (propertiesNode) 
+		{
+			properties.Parse(propertiesNode);
+		}
+	}
+};
diff --git a/src/TMXParser/TmxTile.h b/src/TMXParser/TmxTile.h
index 9e714c8..e69e236 100644
--- a/src/TMXParser/TmxTile.h
+++ b/src/TMXParser/TmxTile.h
@@ -1,61 +1,61 @@
-//-----------------------------------------------------------------------------
-// TmxTile.h
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#pragma once
-
-#include "TmxPropertySet.h"
-
-namespace Tmx 
-{
-	//-------------------------------------------------------------------------
-	// Class to contain information about every tile in the tileset/tiles 
-	// element.
-	// It may expand if there are more elements or attributes added into the
-	// the tile element.
-	// This class also contains a property set.
-	//-------------------------------------------------------------------------
-	class Tile 
-	{
-	public:
-		Tile();
-		~Tile();
-	
-		// Parse a tile node.
-		void Parse(const TiXmlNode *tileNode);
-		
-		// Get the Id. (relative to the tilset)
-		int GetId() const { return id; }
-
-		// Get a set of properties regarding the tile.
-		const PropertySet &GetProperties() const { return properties; }
-
-	private:
-		int id;
-
-		PropertySet properties;
-	};
+//-----------------------------------------------------------------------------
+// TmxTile.h
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#pragma once
+
+#include "TmxPropertySet.h"
+
+namespace Tmx 
+{
+	//-------------------------------------------------------------------------
+	// Class to contain information about every tile in the tileset/tiles 
+	// element.
+	// It may expand if there are more elements or attributes added into the
+	// the tile element.
+	// This class also contains a property set.
+	//-------------------------------------------------------------------------
+	class Tile 
+	{
+	public:
+		Tile();
+		~Tile();
+	
+		// Parse a tile node.
+		void Parse(const TiXmlNode *tileNode);
+		
+		// Get the Id. (relative to the tilset)
+		int GetId() const { return id; }
+
+		// Get a set of properties regarding the tile.
+		const Tmx::PropertySet &GetProperties() const { return properties; }
+
+	private:
+		int id;
+
+		Tmx::PropertySet properties;
+	};
 };
\ No newline at end of file
diff --git a/src/TMXParser/TmxTileset.cpp b/src/TMXParser/TmxTileset.cpp
index 6206760..6806c21 100644
--- a/src/TMXParser/TmxTileset.cpp
+++ b/src/TMXParser/TmxTileset.cpp
@@ -1,123 +1,123 @@
-//-----------------------------------------------------------------------------
-// TmxTileset.cpp
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#include <tinyxml.h>
-
-#include "TmxTileset.h"
-#include "TmxImage.h"
-#include "TmxTile.h"
-
-using std::vector;
-using std::string;
-
-namespace Tmx 
-{
-	Tileset::Tileset() 
-		: first_gid(0)
-		, name()
-		, tile_width(0)
-		, tile_height(0)
-		, margin(0)
-		, spacing(0)
-		, image(NULL)
-		, tiles()
-	{
-	}
-
-	Tileset::~Tileset() 
-	{
-		// Delete the image from memory if allocated.
-		if (image) 
-		{
-			delete image;
-			image = NULL;
-		}
-		
-		// Iterate through all of the tiles in the set and delete each of them.
-		vector< Tile* >::iterator tIter;
-		for (tIter = tiles.begin(); tIter != tiles.end(); ++tIter) 
-		{
-			Tile *tile = (*tIter);
-			
-			if (tile) 
-			{
-				delete tile;
-				tile = NULL;
-			}
-		}
-	}
-
-	void Tileset::Parse(const TiXmlNode *tilesetNode) 
-	{
-		const TiXmlElement *tilesetElem = tilesetNode->ToElement();
-
-		// Read all the attributes into local variables.
-		tilesetElem->Attribute("firstgid", &first_gid);
-		tilesetElem->Attribute("tilewidth", &tile_width);
-		tilesetElem->Attribute("tileheight", &tile_height);
-		tilesetElem->Attribute("margin", &margin);
-		tilesetElem->Attribute("spacing", &spacing);
-
-		name = tilesetElem->Attribute("name");
-
-		// Parse the image.
-		const TiXmlNode *imageNode = tilesetNode->FirstChild("image");
-		
-		if (imageNode) 
-		{
-			image = new Image();
-			image->Parse(imageNode);
-		}
-
-		// Iterate through all of the tile elements and parse each.
-		const TiXmlNode *tileNode = tilesetNode->FirstChild("tile");
-		while (tileNode)
-		{
-			// Allocate a new tile and parse it.
-			Tile *tile = new Tile();
-			tile->Parse(tileNode);
-
-			// Add the tile to the collection.
-			tiles.push_back(tile);
-
-			tileNode = tilesetNode->IterateChildren("tile", tileNode);
-		}
-	}
-
-	const Tile *Tileset::GetTile(int index) const 
-	{
-		for (unsigned int i = 0; i < tiles.size(); ++i) 
-		{
-			if (tiles.at(i)->GetId() == index) 
-			{
-				return tiles.at(i);
-			}
-		}
-
-		return NULL;
-	}
-};
+//-----------------------------------------------------------------------------
+// TmxTileset.cpp
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#include <tinyxml.h>
+
+#include "TmxTileset.h"
+#include "TmxImage.h"
+#include "TmxTile.h"
+
+using std::vector;
+using std::string;
+
+namespace Tmx 
+{
+	Tileset::Tileset() 
+		: first_gid(0)
+		, name()
+		, tile_width(0)
+		, tile_height(0)
+		, margin(0)
+		, spacing(0)
+		, image(NULL)
+		, tiles()
+	{
+	}
+
+	Tileset::~Tileset() 
+	{
+		// Delete the image from memory if allocated.
+		if (image) 
+		{
+			delete image;
+			image = NULL;
+		}
+		
+		// Iterate through all of the tiles in the set and delete each of them.
+		vector< Tile* >::iterator tIter;
+		for (tIter = tiles.begin(); tIter != tiles.end(); ++tIter) 
+		{
+			Tile *tile = (*tIter);
+			
+			if (tile) 
+			{
+				delete tile;
+				tile = NULL;
+			}
+		}
+	}
+
+	void Tileset::Parse(const TiXmlNode *tilesetNode) 
+	{
+		const TiXmlElement *tilesetElem = tilesetNode->ToElement();
+
+		// Read all the attributes into local variables.
+		tilesetElem->Attribute("firstgid", &first_gid);
+		tilesetElem->Attribute("tilewidth", &tile_width);
+		tilesetElem->Attribute("tileheight", &tile_height);
+		tilesetElem->Attribute("margin", &margin);
+		tilesetElem->Attribute("spacing", &spacing);
+
+		name = tilesetElem->Attribute("name");
+
+		// Parse the image.
+		const TiXmlNode *imageNode = tilesetNode->FirstChild("image");
+		
+		if (imageNode) 
+		{
+			image = new Image();
+			image->Parse(imageNode);
+		}
+
+		// Iterate through all of the tile elements and parse each.
+		const TiXmlNode *tileNode = tilesetNode->FirstChild("tile");
+		while (tileNode)
+		{
+			// Allocate a new tile and parse it.
+			Tile *tile = new Tile();
+			tile->Parse(tileNode);
+
+			// Add the tile to the collection.
+			tiles.push_back(tile);
+
+			tileNode = tilesetNode->IterateChildren("tile", tileNode);
+		}
+	}
+
+	const Tile *Tileset::GetTile(int index) const 
+	{
+		for (unsigned int i = 0; i < tiles.size(); ++i) 
+		{
+			if (tiles.at(i)->GetId() == index) 
+			{
+				return tiles.at(i);
+			}
+		}
+
+		return NULL;
+	}
+};
diff --git a/src/TMXParser/TmxTileset.h b/src/TMXParser/TmxTileset.h
index 07dbecf..7661036 100644
--- a/src/TMXParser/TmxTileset.h
+++ b/src/TMXParser/TmxTileset.h
@@ -1,96 +1,96 @@
-//-----------------------------------------------------------------------------
-// TmxTileset.h
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#pragma once
-
-#include <string>
-#include <vector>
-
-class TiXmlNode;
-
-namespace Tmx 
-{
-	class Image;
-	class Tile;
-
-	//-------------------------------------------------------------------------
-	// A class used for storing information about each of the tilesets.
-	// A tileset is a collection of tiles, of whom each may contain properties.
-	// The tileset class itself does not have properties.
-	//-------------------------------------------------------------------------
-	class Tileset 
-	{
-	public:
-		Tileset();
-		~Tileset();
-
-		// Parse a tileset element.
-		void Parse(const TiXmlNode *tilesetNode);
-
-		// Returns the global id of the first tile.
-		int GetFirstGid() const { return first_gid; }
-
-		// Returns the name of the tileset.
-		const std::string &GetName() const { return name; }
-
-		// Get the width of a single tile.
-		int GetTileWidth() const { return tile_width; } 
-
-		// Get the height of a single tile.
-		int GetTileHeight() const { return tile_height; }
-
-		// Get the margin of the tileset.
-		int GetMargin() const { return margin; }
-
-		// Get the spacing of the tileset.
-		int GetSpacing() const { return spacing; }
-
-		// Returns a variable containing information 
-		// about the image of the tileset.
-		const Image* GetImage() const { return image; }
-
-		// Returns a a single tile of the set.
-		const Tile *GetTile(int index) const;
-
-		// Returns the whole tile collection.
-		const std::vector< Tile *> &GetTiles() const { return tiles; } 
-
-	private:
-		int first_gid;
-		
-		std::string name;
-		
-		int tile_width;
-		int tile_height;
-		int margin;
-		int spacing;
-		
-		Image* image;
-
-		std::vector< Tile* > tiles;
-	};
+//-----------------------------------------------------------------------------
+// TmxTileset.h
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#pragma once
+
+#include <string>
+#include <vector>
+
+class TiXmlNode;
+
+namespace Tmx 
+{
+	class Image;
+	class Tile;
+
+	//-------------------------------------------------------------------------
+	// A class used for storing information about each of the tilesets.
+	// A tileset is a collection of tiles, of whom each may contain properties.
+	// The tileset class itself does not have properties.
+	//-------------------------------------------------------------------------
+	class Tileset 
+	{
+	public:
+		Tileset();
+		~Tileset();
+
+		// Parse a tileset element.
+		void Parse(const TiXmlNode *tilesetNode);
+
+		// Returns the global id of the first tile.
+		int GetFirstGid() const { return first_gid; }
+
+		// Returns the name of the tileset.
+		const std::string &GetName() const { return name; }
+
+		// Get the width of a single tile.
+		int GetTileWidth() const { return tile_width; } 
+
+		// Get the height of a single tile.
+		int GetTileHeight() const { return tile_height; }
+
+		// Get the margin of the tileset.
+		int GetMargin() const { return margin; }
+
+		// Get the spacing of the tileset.
+		int GetSpacing() const { return spacing; }
+
+		// Returns a variable containing information 
+		// about the image of the tileset.
+		const Tmx::Image* GetImage() const { return image; }
+
+		// Returns a a single tile of the set.
+		const Tmx::Tile *GetTile(int index) const;
+
+		// Returns the whole tile collection.
+		const std::vector< Tmx::Tile *> &GetTiles() const { return tiles; } 
+
+	private:
+		int first_gid;
+		
+		std::string name;
+		
+		int tile_width;
+		int tile_height;
+		int margin;
+		int spacing;
+		
+		Tmx::Image* image;
+
+		std::vector< Tmx::Tile* > tiles;
+	};
 };
\ No newline at end of file
diff --git a/src/TMXParser/TmxUtil.cpp b/src/TMXParser/TmxUtil.cpp
index c83b30d..92e2340 100644
--- a/src/TMXParser/TmxUtil.cpp
+++ b/src/TMXParser/TmxUtil.cpp
@@ -1,107 +1,107 @@
-//-----------------------------------------------------------------------------
-// TmxUtil.cpp
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#include <stdlib.h>
-#include <zlib.h>
-
-#include "TmxUtil.h"
-#include "base64.h"
-
-namespace Tmx {
-	std::string Util::DecodeBase64(const std::string &str) 
-	{
-		return base64_decode(str);
-	}
-
-	char *Util::DecompressGZIP(const char *data, int dataSize, int expectedSize) 
-	{
-		int bufferSize = expectedSize;
-		int ret;
-		z_stream strm;
-		char *out = (char*)malloc(bufferSize);
-
-		strm.zalloc = Z_NULL;
-		strm.zfree = Z_NULL;
-		strm.opaque = Z_NULL;
-		strm.next_in = (Bytef*)data;
-		strm.avail_in = dataSize;
-		strm.next_out = (Bytef*)out;
-		strm.avail_out = bufferSize;
-
-		ret = inflateInit2(&strm, 15 + 32);
-
-		if (ret != Z_OK) 
-		{
-			free(out);
-			return NULL;
-		}
-
-		do 
-		{
-			ret = inflate(&strm, Z_SYNC_FLUSH);
-
-			switch (ret) 
-			{
-				case Z_NEED_DICT:
-				case Z_STREAM_ERROR:
-					ret = Z_DATA_ERROR;
-				case Z_DATA_ERROR:
-				case Z_MEM_ERROR:
-					inflateEnd(&strm);
-					free(out);
-					return NULL;
-			}
-
-			if (ret != Z_STREAM_END) 
-			{
-				out = (char *) realloc(out, bufferSize * 2);
-
-				if (!out) 
-				{
-					inflateEnd(&strm);
-					free(out);
-					return NULL;
-				}
-
-				strm.next_out = (Bytef *)(out + bufferSize);
-				strm.avail_out = bufferSize;
-				bufferSize *= 2;
-			}
-		}
-		while (ret != Z_STREAM_END);
-
-		if (strm.avail_in != 0) 
-		{
-			free(out);
-			return NULL;
-		}
-
-		inflateEnd(&strm);
-
-		return out;
-	}
-};
+//-----------------------------------------------------------------------------
+// TmxUtil.cpp
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#include <stdlib.h>
+#include <zlib.h>
+
+#include "TmxUtil.h"
+#include "base64/base64.h"
+
+namespace Tmx {
+	std::string Util::DecodeBase64(const std::string &str) 
+	{
+		return base64_decode(str);
+	}
+
+	char *Util::DecompressGZIP(const char *data, int dataSize, int expectedSize) 
+	{
+		int bufferSize = expectedSize;
+		int ret;
+		z_stream strm;
+		char *out = (char*)malloc(bufferSize);
+
+		strm.zalloc = Z_NULL;
+		strm.zfree = Z_NULL;
+		strm.opaque = Z_NULL;
+		strm.next_in = (Bytef*)data;
+		strm.avail_in = dataSize;
+		strm.next_out = (Bytef*)out;
+		strm.avail_out = bufferSize;
+
+		ret = inflateInit2(&strm, 15 + 32);
+
+		if (ret != Z_OK) 
+		{
+			free(out);
+			return NULL;
+		}
+
+		do 
+		{
+			ret = inflate(&strm, Z_SYNC_FLUSH);
+
+			switch (ret) 
+			{
+				case Z_NEED_DICT:
+				case Z_STREAM_ERROR:
+					ret = Z_DATA_ERROR;
+				case Z_DATA_ERROR:
+				case Z_MEM_ERROR:
+					inflateEnd(&strm);
+					free(out);
+					return NULL;
+			}
+
+			if (ret != Z_STREAM_END) 
+			{
+				out = (char *) realloc(out, bufferSize * 2);
+
+				if (!out) 
+				{
+					inflateEnd(&strm);
+					free(out);
+					return NULL;
+				}
+
+				strm.next_out = (Bytef *)(out + bufferSize);
+				strm.avail_out = bufferSize;
+				bufferSize *= 2;
+			}
+		}
+		while (ret != Z_STREAM_END);
+
+		if (strm.avail_in != 0) 
+		{
+			free(out);
+			return NULL;
+		}
+
+		inflateEnd(&strm);
+
+		return out;
+	}
+};
diff --git a/src/TMXParser/TmxUtil.h b/src/TMXParser/TmxUtil.h
index dbbcc01..0153667 100644
--- a/src/TMXParser/TmxUtil.h
+++ b/src/TMXParser/TmxUtil.h
@@ -1,43 +1,43 @@
-//-----------------------------------------------------------------------------
-// TmxUtil.h
-//
-// Copyright (c) 2010-2012, Tamir Atias
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
-// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Tamir Atias
-//-----------------------------------------------------------------------------
-#pragma once
-
-#include <string>
-
-namespace Tmx 
-{
-	class Util 
-	{
-	public:
-		// Decode a base-64 encoded string.
-		static std::string DecodeBase64(const std::string &str);
-
-		// Decompress a gzip encoded byte array.
-		static char* DecompressGZIP(const char *data, int dataSize, int expectedSize);
-	};
+//-----------------------------------------------------------------------------
+// TmxUtil.h
+//
+// Copyright (c) 2010-2012, Tamir Atias
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL TAMIR ATIAS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Tamir Atias
+//-----------------------------------------------------------------------------
+#pragma once
+
+#include <string>
+
+namespace Tmx 
+{
+	class Util 
+	{
+	public:
+		// Decode a base-64 encoded string.
+		static std::string DecodeBase64(const std::string &str);
+
+		// Decompress a gzip encoded byte array.
+		static char* DecompressGZIP(const char *data, int dataSize, int expectedSize);
+	};
 };
\ No newline at end of file
diff --git a/src/TMXParser/base64.cpp b/src/TMXParser/base64/base64.cpp
similarity index 96%
rename from src/TMXParser/base64.cpp
rename to src/TMXParser/base64/base64.cpp
index 50006d4..0895179 100644
--- a/src/TMXParser/base64.cpp
+++ b/src/TMXParser/base64/base64.cpp
@@ -1,123 +1,123 @@
-/* 
-   base64.cpp and base64.h
-
-   Copyright (C) 2004-2008 Ren� Nyffenegger
-
-   This source code is provided 'as-is', without any express or implied
-   warranty. In no event will the author be held liable for any damages
-   arising from the use of this software.
-
-   Permission is granted to anyone to use this software for any purpose,
-   including commercial applications, and to alter it and redistribute it
-   freely, subject to the following restrictions:
-
-   1. The origin of this source code must not be misrepresented; you must not
-      claim that you wrote the original source code. If you use this source code
-      in a product, an acknowledgment in the product documentation would be
-      appreciated but is not required.
-
-   2. Altered source versions must be plainly marked as such, and must not be
-      misrepresented as being the original source code.
-
-   3. This notice may not be removed or altered from any source distribution.
-
-   Ren� Nyffenegger rene.nyffenegger@adp-gmbh.ch
-
-*/
-
-#include "base64.h"
-#include <iostream>
-
-static const std::string base64_chars = 
-             "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-             "abcdefghijklmnopqrstuvwxyz"
-             "0123456789+/";
-
-
-static inline bool is_base64(unsigned char c) {
-  return (isalnum(c) || (c == '+') || (c == '/'));
-}
-
-std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) {
-  std::string ret;
-  int i = 0;
-  int j = 0;
-  unsigned char char_array_3[3];
-  unsigned char char_array_4[4];
-
-  while (in_len--) {
-    char_array_3[i++] = *(bytes_to_encode++);
-    if (i == 3) {
-      char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
-      char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
-      char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
-      char_array_4[3] = char_array_3[2] & 0x3f;
-
-      for(i = 0; (i <4) ; i++)
-        ret += base64_chars[char_array_4[i]];
-      i = 0;
-    }
-  }
-
-  if (i)
-  {
-    for(j = i; j < 3; j++)
-      char_array_3[j] = '\0';
-
-    char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
-    char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
-    char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
-    char_array_4[3] = char_array_3[2] & 0x3f;
-
-    for (j = 0; (j < i + 1); j++)
-      ret += base64_chars[char_array_4[j]];
-
-    while((i++ < 3))
-      ret += '=';
-
-  }
-
-  return ret;
-
-}
-
-std::string base64_decode(std::string const& encoded_string) {
-  int in_len = encoded_string.size();
-  int i = 0;
-  int j = 0;
-  int in_ = 0;
-  unsigned char char_array_4[4], char_array_3[3];
-  std::string ret;
-
-  while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) {
-    char_array_4[i++] = encoded_string[in_]; in_++;
-    if (i ==4) {
-      for (i = 0; i <4; i++)
-        char_array_4[i] = base64_chars.find(char_array_4[i]);
-
-      char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
-      char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
-      char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
-
-      for (i = 0; (i < 3); i++)
-        ret += char_array_3[i];
-      i = 0;
-    }
-  }
-
-  if (i) {
-    for (j = i; j <4; j++)
-      char_array_4[j] = 0;
-
-    for (j = 0; j <4; j++)
-      char_array_4[j] = base64_chars.find(char_array_4[j]);
-
-    char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
-    char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
-    char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
-
-    for (j = 0; (j < i - 1); j++) ret += char_array_3[j];
-  }
-
-  return ret;
+/* 
+   base64.cpp and base64.h
+
+   Copyright (C) 2004-2008 Ren� Nyffenegger
+
+   This source code is provided 'as-is', without any express or implied
+   warranty. In no event will the author be held liable for any damages
+   arising from the use of this software.
+
+   Permission is granted to anyone to use this software for any purpose,
+   including commercial applications, and to alter it and redistribute it
+   freely, subject to the following restrictions:
+
+   1. The origin of this source code must not be misrepresented; you must not
+      claim that you wrote the original source code. If you use this source code
+      in a product, an acknowledgment in the product documentation would be
+      appreciated but is not required.
+
+   2. Altered source versions must be plainly marked as such, and must not be
+      misrepresented as being the original source code.
+
+   3. This notice may not be removed or altered from any source distribution.
+
+   Ren� Nyffenegger rene.nyffenegger@adp-gmbh.ch
+
+*/
+
+#include "base64.h"
+#include <iostream>
+
+static const std::string base64_chars = 
+             "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+             "abcdefghijklmnopqrstuvwxyz"
+             "0123456789+/";
+
+
+static inline bool is_base64(unsigned char c) {
+  return (isalnum(c) || (c == '+') || (c == '/'));
+}
+
+std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) {
+  std::string ret;
+  int i = 0;
+  int j = 0;
+  unsigned char char_array_3[3];
+  unsigned char char_array_4[4];
+
+  while (in_len--) {
+    char_array_3[i++] = *(bytes_to_encode++);
+    if (i == 3) {
+      char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
+      char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
+      char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
+      char_array_4[3] = char_array_3[2] & 0x3f;
+
+      for(i = 0; (i <4) ; i++)
+        ret += base64_chars[char_array_4[i]];
+      i = 0;
+    }
+  }
+
+  if (i)
+  {
+    for(j = i; j < 3; j++)
+      char_array_3[j] = '\0';
+
+    char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
+    char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
+    char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
+    char_array_4[3] = char_array_3[2] & 0x3f;
+
+    for (j = 0; (j < i + 1); j++)
+      ret += base64_chars[char_array_4[j]];
+
+    while((i++ < 3))
+      ret += '=';
+
+  }
+
+  return ret;
+
+}
+
+std::string base64_decode(std::string const& encoded_string) {
+  int in_len = encoded_string.size();
+  int i = 0;
+  int j = 0;
+  int in_ = 0;
+  unsigned char char_array_4[4], char_array_3[3];
+  std::string ret;
+
+  while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) {
+    char_array_4[i++] = encoded_string[in_]; in_++;
+    if (i ==4) {
+      for (i = 0; i <4; i++)
+        char_array_4[i] = base64_chars.find(char_array_4[i]);
+
+      char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
+      char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
+      char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
+
+      for (i = 0; (i < 3); i++)
+        ret += char_array_3[i];
+      i = 0;
+    }
+  }
+
+  if (i) {
+    for (j = i; j <4; j++)
+      char_array_4[j] = 0;
+
+    for (j = 0; j <4; j++)
+      char_array_4[j] = base64_chars.find(char_array_4[j]);
+
+    char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
+    char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
+    char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
+
+    for (j = 0; (j < i - 1); j++) ret += char_array_3[j];
+  }
+
+  return ret;
 }
\ No newline at end of file
diff --git a/src/TMXParser/base64.h b/src/TMXParser/base64/base64.h
similarity index 96%
rename from src/TMXParser/base64.h
rename to src/TMXParser/base64/base64.h
index 2af9b82..80a4ee5 100644
--- a/src/TMXParser/base64.h
+++ b/src/TMXParser/base64/base64.h
@@ -1,35 +1,35 @@
-/* 
-   base64.cpp and base64.h
-
-   Copyright (C) 2004-2008 Ren� Nyffenegger
-
-   This source code is provided 'as-is', without any express or implied
-   warranty. In no event will the author be held liable for any damages
-   arising from the use of this software.
-
-   Permission is granted to anyone to use this software for any purpose,
-   including commercial applications, and to alter it and redistribute it
-   freely, subject to the following restrictions:
-
-   1. The origin of this source code must not be misrepresented; you must not
-      claim that you wrote the original source code. If you use this source code
-      in a product, an acknowledgment in the product documentation would be
-      appreciated but is not required.
-
-   2. Altered source versions must be plainly marked as such, and must not be
-      misrepresented as being the original source code.
-
-   3. This notice may not be removed or altered from any source distribution.
-
-   Ren� Nyffenegger rene.nyffenegger@adp-gmbh.ch
-
-*/
-#ifndef TMXPARSER_BASE64_H_
-#define TMXPARSER_BASE64_H_
-
-#include <string>
-
-std::string base64_encode(unsigned char const* , unsigned int len);
-std::string base64_decode(std::string const& s);
-
+/* 
+   base64.cpp and base64.h
+
+   Copyright (C) 2004-2008 Ren� Nyffenegger
+
+   This source code is provided 'as-is', without any express or implied
+   warranty. In no event will the author be held liable for any damages
+   arising from the use of this software.
+
+   Permission is granted to anyone to use this software for any purpose,
+   including commercial applications, and to alter it and redistribute it
+   freely, subject to the following restrictions:
+
+   1. The origin of this source code must not be misrepresented; you must not
+      claim that you wrote the original source code. If you use this source code
+      in a product, an acknowledgment in the product documentation would be
+      appreciated but is not required.
+
+   2. Altered source versions must be plainly marked as such, and must not be
+      misrepresented as being the original source code.
+
+   3. This notice may not be removed or altered from any source distribution.
+
+   Ren� Nyffenegger rene.nyffenegger@adp-gmbh.ch
+
+*/
+#ifndef TMXPARSER_BASE64_H_
+#define TMXPARSER_BASE64_H_
+
+#include <string>
+
+std::string base64_encode(unsigned char const* , unsigned int len);
+std::string base64_decode(std::string const& s);
+
 #endif
\ No newline at end of file