diff --git a/Makefile b/Makefile
index f7382f5..30ddf7e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
test:
dotnet build src/DotTiled.sln
dotnet test src/DotTiled.sln
+ dotnet run --project src/DotTiled.Examples/DotTiled.Example.Console/DotTiled.Example.Console.csproj -- src/DotTiled.Examples/DotTiled.Example.Console
docs-serve: docs/index.md
docfx docs/docfx.json --serve
diff --git a/docs/docs/essentials/representation-model.md b/docs/docs/essentials/representation-model.md
index 88dbdff..9fef3e0 100644
--- a/docs/docs/essentials/representation-model.md
+++ b/docs/docs/essentials/representation-model.md
@@ -14,4 +14,4 @@ The representation model is designed to be compatible with the latest version of
| Tiled version | Compatible DotTiled version(s) |
|---------------|--------------------------------|
-| 1.11 | 0.1.0, 0.2.0 |
\ No newline at end of file
+| 1.11 | 0.1.0, 0.2.0, 0.2.1 |
\ No newline at end of file
diff --git a/src/DotTiled.Examples/DotTiled.Example.Console/DotTiled.Example.Console.csproj b/src/DotTiled.Examples/DotTiled.Example.Console/DotTiled.Example.Console.csproj
index c9bf1a8..0dbaba2 100644
--- a/src/DotTiled.Examples/DotTiled.Example.Console/DotTiled.Example.Console.csproj
+++ b/src/DotTiled.Examples/DotTiled.Example.Console/DotTiled.Example.Console.csproj
@@ -12,27 +12,9 @@
-
- Always
-
-
- Always
-
-
- Always
-
-
- Always
-
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/src/DotTiled.Examples/DotTiled.Example.Console/Program.cs b/src/DotTiled.Examples/DotTiled.Example.Console/Program.cs
index 234012a..9dba3df 100644
--- a/src/DotTiled.Examples/DotTiled.Example.Console/Program.cs
+++ b/src/DotTiled.Examples/DotTiled.Example.Console/Program.cs
@@ -5,18 +5,20 @@ namespace DotTiled.Example;
public class Program
{
- private static void Main()
+ private static void Main(string[] args)
{
- Quick();
+ Quick(args[0]);
Manual();
}
// QUICK START
// Automatic and easy way to load tilemaps.
- private static void Quick()
+ private static void Quick(string basePath)
{
+ var tilemapPath = Path.Combine(basePath, "tilemap.tmx");
+
var loader = Loader.Default();
- var map = loader.LoadMap("tilemap.tmx");
+ var map = loader.LoadMap(tilemapPath);
// You can do stuff with it like...
Console.WriteLine($"Tile width and height: {map.TileWidth}x{map.TileHeight}");
@@ -28,9 +30,10 @@ public class Program
// Manually load a map, if you need to load from a custom source
private static void Manual()
{
- using var mapFileReader = new StreamReader("tilemap.tmx");
- var mapString = mapFileReader.ReadToEnd();
- using var mapReader = new MapReader(mapString, ResolveTileset, ResolveTemplate, ResolveCustomType);
+ using Stream? tilemapStream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"DotTiled.Example.Console.tilemap.tmx")
+ ?? throw new FileLoadException($"DotTiled.Example.Console.tilemap.tmx not found in assembly.");
+ string tileMapString = new StreamReader(tilemapStream).ReadToEnd();
+ using var mapReader = new MapReader(tileMapString, ResolveTileset, ResolveTemplate, ResolveCustomType);
var map = mapReader.ReadMap();
// Now do some other stuff with it...
@@ -50,7 +53,7 @@ public class Program
{
// Read a file from assembly
// You can use any other source for files, eg. compressed archive, or even file from internet.
- using Stream? tilesetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"DotTiled.Example.embedded-{source}")
+ using Stream? tilesetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"DotTiled.Example.Console.{source}")
?? throw new FileLoadException($"{source} not found in assembly.");
string tilesetString = new StreamReader(tilesetStream).ReadToEnd();
@@ -62,7 +65,7 @@ public class Program
// This is pretty similar to above, but instead it loads templates, not tilesets.
private static Template ResolveTemplate(string source)
{
- using Stream? templateStream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"DotTiled.Example.{source}")
+ using Stream? templateStream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"DotTiled.Example.Console.{source}")
?? throw new FileLoadException($"{source} not found in assembly.");
string templateString = new StreamReader(templateStream).ReadToEnd();
diff --git a/src/DotTiled.Examples/DotTiled.Example.Console/embedded-tilemap.tmx b/src/DotTiled.Examples/DotTiled.Example.Console/embedded-tilemap.tmx
deleted file mode 100644
index 7a9a294..0000000
--- a/src/DotTiled.Examples/DotTiled.Example.Console/embedded-tilemap.tmx
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
diff --git a/src/DotTiled.Examples/DotTiled.Example.Console/embedded-tileset.png b/src/DotTiled.Examples/DotTiled.Example.Console/embedded-tileset.png
deleted file mode 100644
index 67b9eee..0000000
Binary files a/src/DotTiled.Examples/DotTiled.Example.Console/embedded-tileset.png and /dev/null differ
diff --git a/src/DotTiled.Examples/DotTiled.Example.Console/embedded-tileset.tsx b/src/DotTiled.Examples/DotTiled.Example.Console/embedded-tileset.tsx
deleted file mode 100644
index 9fc1b9b..0000000
--- a/src/DotTiled.Examples/DotTiled.Example.Console/embedded-tileset.tsx
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/src/DotTiled/DotTiled.csproj b/src/DotTiled/DotTiled.csproj
index acf3e99..a5d41c3 100644
--- a/src/DotTiled/DotTiled.csproj
+++ b/src/DotTiled/DotTiled.csproj
@@ -18,7 +18,7 @@
true
Copyright © 2024 dcronqvist
LICENSE
- 0.2.0
+ 0.2.1
diff --git a/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs b/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs
index 85c669c..46626e6 100644
--- a/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs
+++ b/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs
@@ -97,7 +97,7 @@ public abstract partial class TmxReaderBase
var height = _reader.GetOptionalAttributeParseable("height").GetValueOr(heightDefault);
var rotation = _reader.GetOptionalAttributeParseable("rotation").GetValueOr(rotationDefault);
var gid = _reader.GetOptionalAttributeParseable("gid").GetValueOrOptional(gidDefault);
- var visible = _reader.GetOptionalAttributeParseable("visible").GetValueOr(visibleDefault);
+ var visible = _reader.GetOptionalAttributeParseable("visible").GetValueOr(visibleDefault ? 1u : 0u) == 1;
// Elements
DotTiled.Object foundObject = null;