Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ragath/TiledLib.Net

Repository files navigation

TiledLib.Net

.NET
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. If you add a ContentProcessor, you will be able to map the output of the supplied importer to custom classes tailored specifically for your game.

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

AltStyle によって変換されたページ (->オリジナル) /