From 30318e6194c69d5af64be03fb79cd321ceeb06e2 Mon Sep 17 00:00:00 2001 From: Daniel Cronqvist Date: Sat, 27 Jul 2024 23:53:04 +0200 Subject: [PATCH] Initial README update, rebase and amend this commit --- README.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 81fe9e5..f5692b5 100644 --- a/README.md +++ b/README.md @@ -1 +1,26 @@ -# DotTiled \ No newline at end of file +# 📚 DotTiled + +DotTiled is a simple, lightweight, and easy-to-use library for loading, saving, and managing Tiled maps and tilesets in your .NET projects. After [TiledCS](https://github.com/TheBoneJarmer/TiledCS) unfortunately became unmaintained (since 2022), I aimed to create a new library that could fill its shoes. DotTiled is the result of that effort. + +## Quickstart + +### Loading a map with external tilesets + +```csharp +using DotTiled; + +TmxSerializer tmxSerializer; + +// Tiled can store tilesets in external files or in a map itself +// When they are stored externally, you need to provide a way +// to resolve them given their source path +Func externalTilesetResolver = (string path) => +{ + // Load the tileset from however you want + var tilesetXml = fileSystem.ReadAllText(path); + var xmlStringReader = new StringReader(tilesetXml); + var xmlReader = XmlReader.Create(xmlStringReader); + var tmxSerializer = tmxSerializer.DeserializeTileset(xmlReader); +}; + +``` \ No newline at end of file