private static TileSheet LoadTileset(TmxTileset tileset, Size tilesSize, GameResourceManager gameResourceManager)
        {
            var texturePath = Path.Combine(Path.GetDirectoryName(tileset.Image.Source), Path.GetFileNameWithoutExtension(tileset.Image.Source))
                .Remove(0, ContentFolder.Length + 1);
            //var texture = gameResourceManager.GetTexture(@"Tiled\tmw_desert_spacing");
            var texture = gameResourceManager.GetTexture(texturePath);
            //var sheet = new TileSheet(texture, "Desert", new Size(tmxMap.TileWidth, tmxMap.TileHeight));

            var sheet = gameResourceManager.GetTileSheet(tileset.Name);
            if (sheet == null)
            {
                sheet = new TileSheet(texture, tileset.Name, tilesSize);

                var margin = tileset.Margin;
                var spacing = tileset.Spacing;
                var numTileWidth = (tileset.Image.Width - (2 * margin) + spacing) / (tileset.TileWidth + spacing);
                var numTileHeight = (tileset.Image.Height - (2 * margin) + spacing) / (tileset.TileHeight + spacing);

                for (var j = 0; j < numTileHeight; j++)
                    for (var i = 0; i < numTileWidth; i++)
                        sheet.CreateTileDefinition((tileset.FirstGid + i + numTileWidth * j).ToString(),
                            new Point(margin + i * (tileset.TileWidth + spacing), margin + j * (tileset.TileHeight + spacing)));

                gameResourceManager.AddTileSheet(sheet);
            }

            return sheet;
        }
        private TileLayer CreateTileLayer()
        {
            var texture = this.ResourceManager.GetTexture(@"Sandbox\TileSheet");
            var sheet = new TileSheet(texture, "Background", new Size(16, 16));
            var red = sheet.CreateTileDefinition("red", new Point(0, 0));
            var green = sheet.CreateTileDefinition("green", new Point(16, 0));
            var yellow = sheet.CreateTileDefinition("yellow", new Point(32, 0));
            var purple = sheet.CreateTileDefinition("purple", new Point(0, 16));
            sheet.CreateTileDefinition("orange", new Point(16, 16));
            sheet.CreateTileDefinition("blue", new Point(32, 16));

            //sheet.Save(@"C:\Users\Pascal\Dev\DotNet\GitHub\XNAGameEngine2D\Color TileSheet.xml");

            this.ResourceManager.AddTileSheet(sheet);

            var tileLayer = new TileLayer("Tiles", new Size(32, 32), new Size(16, 16));
            tileLayer[0, 0] = purple;
            tileLayer[0, 1] = green;
            tileLayer[1, 0] = yellow;
            tileLayer[1, 1] = red;
            tileLayer[10, 10] = purple;
            tileLayer[4, 20] = green;

            tileLayer.ParallaxScrollingVector = new Vector(2.0f, 2.0f);
            tileLayer.Offset = new Vector(0, -20);

            return tileLayer;
        }