8000 GitHub - Ragath/TiledLib.Net at v3.0.0
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Ragath/TiledLib.Net

Folders and files

< ACCA td class="react-directory-row-name-cell-large-screen" colSpan="1">
NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TiledLib.Net

Build status
Cross-platform Tiled map parsing utilities.

Nugets

TiledLib - Core library, everything you need to read Tiled maps/tilesets.
TiledLib.Pipeline - MonoGame content pipeline extension, provides a ContentImporter for Tiled maps.

Basic usecase

using (var stream = File.OpenRead(filename))
{
  var map = Map.FromStream(stream, ts => File.OpenRead(Path.Combine(Path.GetDirectoryName(filename), ts.source)));

  foreach (var layer in map.Layers.OfType<TileLayer>())
  {
    for (int y = 0, i = 0; y < layer.Height; y++)
      for (int x = 0; x < layer.Width; x++, i++)
      {
        var gid = layer.data[i];
        if (gid == 0)
            continue;

        var tileset = map.Tilesets.Single(ts => gid >= ts.firstgid && ts.firstgid + ts.TileCount > gid);
        var tile = tileset[gid];

        // Do stuff with the tile.
      }
  }
}

About

Cross-platform Tiled map parsing utilities.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  
0