Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 1.01 KB

README.md

File metadata and controls

33 lines (24 loc) · 1.01 KB

PCL Tiled Map File Parser

TMXParserPCL is C# library for parsing Tiled Map's TMX files.

nugetpkg

Usage:

// -- Load a file how you want in PCL
var fileStream = File.Open("map.tmx", FileMode.Open);

var map = Map.Load(fileStream);


// If TileSet is an external file
var loadedExternalTileSets = new List<TileSet>();
var loadedImages = new List<Bitmap>();
foreach (var tileSet in map.TileSets)
{
  // -- Load a file how you want in PCL
  var fileStream = File.Open(tileSet.Source, FileMode.Open);
  
  var tileSetLoaded = TileSet.LoadExternal(fileStream, tileSet);

  // -- Load a file how you want in PCL
  var pictureStream = File.Open(tileSetLoaded.Image.Source, FileMode.Open);
  var picture = new Bitmap(pictureStream);
  loadedImages.Add(picture);

  loadedExternalTileSets.Add(tileSetLoaded);
}

There isn't really an other way to load external TileSets, it's needed to be serialized second time