diff --git a/Makefile b/Makefile
index 66cf561..5e6402f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,17 +1,18 @@
-test:
- dotnet test src/DotTiled.sln
-
-docs-serve: docs-build
- docfx docs/docfx.json --serve
-
-docs-build:
- cp README.md docs/index.md
- docfx docs/docfx.json
-
-BENCHMARK_SOURCES = DotTiled.Benchmark/Program.cs DotTiled.Benchmark/DotTiled.Benchmark.csproj
-BENCHMARK_OUTPUTDIR = DotTiled.Benchmark/BenchmarkDotNet.Artifacts
-.PHONY: benchmark
-benchmark: $(BENCHMARK_OUTPUTDIR)/results/MyBenchmarks.MapLoading-report-github.md
-
-$(BENCHMARK_OUTPUTDIR)/results/MyBenchmarks.MapLoading-report-github.md: $(BENCHMARK_SOURCES)
+test:
+ dotnet build src/DotTiled.sln
+ dotnet test src/DotTiled.sln
+
+docs-serve:
+ docfx docs/docfx.json --serve
+
+docs-build:
+ cp README.md docs/index.md
+ docfx docs/docfx.json
+
+BENCHMARK_SOURCES = DotTiled.Benchmark/Program.cs DotTiled.Benchmark/DotTiled.Benchmark.csproj
+BENCHMARK_OUTPUTDIR = DotTiled.Benchmark/BenchmarkDotNet.Artifacts
+.PHONY: benchmark
+benchmark: $(BENCHMARK_OUTPUTDIR)/results/MyBenchmarks.MapLoading-report-github.md
+
+$(BENCHMARK_OUTPUTDIR)/results/MyBenchmarks.MapLoading-report-github.md: $(BENCHMARK_SOURCES)
dotnet run --project DotTiled.Benchmark/DotTiled.Benchmark.csproj -c Release -- $(BENCHMARK_OUTPUTDIR)
\ No newline at end of file
diff --git a/docs/docfx.json b/docs/docfx.json
index fa6feed..4c955cb 100644
--- a/docs/docfx.json
+++ b/docs/docfx.json
@@ -9,7 +9,8 @@
]
}
],
- "dest": "api"
+ "dest": "api",
+ "enumSortOrder": "declaringOrder"
}
],
"build": {
diff --git a/src/DotTiled.Tests/Assert/AssertData.cs b/src/DotTiled.Tests/Assert/AssertData.cs
index 3c18ef9..3ddcf4a 100644
--- a/src/DotTiled.Tests/Assert/AssertData.cs
+++ b/src/DotTiled.Tests/Assert/AssertData.cs
@@ -1,4 +1,4 @@
-using DotTiled.Model.Layers;
+using DotTiled.Model;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Assert/AssertImage.cs b/src/DotTiled.Tests/Assert/AssertImage.cs
index 613318b..51a9b82 100644
--- a/src/DotTiled.Tests/Assert/AssertImage.cs
+++ b/src/DotTiled.Tests/Assert/AssertImage.cs
@@ -1,4 +1,4 @@
-using DotTiled.Model.Tilesets;
+using DotTiled.Model;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Assert/AssertLayer.cs b/src/DotTiled.Tests/Assert/AssertLayer.cs
index 1cb9e36..89886cc 100644
--- a/src/DotTiled.Tests/Assert/AssertLayer.cs
+++ b/src/DotTiled.Tests/Assert/AssertLayer.cs
@@ -1,4 +1,4 @@
-using DotTiled.Model.Layers;
+using DotTiled.Model;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Assert/AssertObject.cs b/src/DotTiled.Tests/Assert/AssertObject.cs
index f234ed2..d982ebd 100644
--- a/src/DotTiled.Tests/Assert/AssertObject.cs
+++ b/src/DotTiled.Tests/Assert/AssertObject.cs
@@ -1,22 +1,22 @@
-using DotTiled.Model.Layers.Objects;
+using DotTiled.Model;
namespace DotTiled.Tests;
public static partial class DotTiledAssert
{
- internal static void AssertObject(Model.Layers.Objects.Object expected, Model.Layers.Objects.Object actual)
+ internal static void AssertObject(Model.Object expected, Model.Object actual)
{
// Attributes
- AssertEqual(expected.ID, actual.ID, nameof(Model.Layers.Objects.Object.ID));
- AssertEqual(expected.Name, actual.Name, nameof(Model.Layers.Objects.Object.Name));
- AssertEqual(expected.Type, actual.Type, nameof(Model.Layers.Objects.Object.Type));
- AssertEqual(expected.X, actual.X, nameof(Model.Layers.Objects.Object.X));
- AssertEqual(expected.Y, actual.Y, nameof(Model.Layers.Objects.Object.Y));
- AssertEqual(expected.Width, actual.Width, nameof(Model.Layers.Objects.Object.Width));
- AssertEqual(expected.Height, actual.Height, nameof(Model.Layers.Objects.Object.Height));
- AssertEqual(expected.Rotation, actual.Rotation, nameof(Model.Layers.Objects.Object.Rotation));
- AssertEqual(expected.Visible, actual.Visible, nameof(Model.Layers.Objects.Object.Visible));
- AssertEqual(expected.Template, actual.Template, nameof(Model.Layers.Objects.Object.Template));
+ AssertEqual(expected.ID, actual.ID, nameof(Model.Object.ID));
+ AssertEqual(expected.Name, actual.Name, nameof(Model.Object.Name));
+ AssertEqual(expected.Type, actual.Type, nameof(Model.Object.Type));
+ AssertEqual(expected.X, actual.X, nameof(Model.Object.X));
+ AssertEqual(expected.Y, actual.Y, nameof(Model.Object.Y));
+ AssertEqual(expected.Width, actual.Width, nameof(Model.Object.Width));
+ AssertEqual(expected.Height, actual.Height, nameof(Model.Object.Height));
+ AssertEqual(expected.Rotation, actual.Rotation, nameof(Model.Object.Rotation));
+ AssertEqual(expected.Visible, actual.Visible, nameof(Model.Object.Visible));
+ AssertEqual(expected.Template, actual.Template, nameof(Model.Object.Template));
AssertProperties(expected.Properties, actual.Properties);
diff --git a/src/DotTiled.Tests/Assert/AssertProperties.cs b/src/DotTiled.Tests/Assert/AssertProperties.cs
index ddd0e69..16d9cdb 100644
--- a/src/DotTiled.Tests/Assert/AssertProperties.cs
+++ b/src/DotTiled.Tests/Assert/AssertProperties.cs
@@ -1,4 +1,4 @@
-using DotTiled.Model.Properties;
+using DotTiled.Model;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Assert/AssertTileset.cs b/src/DotTiled.Tests/Assert/AssertTileset.cs
index c0e5e8e..3e4ab28 100644
--- a/src/DotTiled.Tests/Assert/AssertTileset.cs
+++ b/src/DotTiled.Tests/Assert/AssertTileset.cs
@@ -1,5 +1,5 @@
-using DotTiled.Model.Layers;
-using DotTiled.Model.Tilesets;
+using DotTiled.Model;
+using DotTiled.Model;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Serialization/TestData.cs b/src/DotTiled.Tests/Serialization/TestData.cs
index 467e1df..30c4b9f 100644
--- a/src/DotTiled.Tests/Serialization/TestData.cs
+++ b/src/DotTiled.Tests/Serialization/TestData.cs
@@ -1,6 +1,6 @@
using System.Xml;
-using DotTiled.Model.Properties;
-using DotTiled.Model.Properties.CustomTypes;
+using DotTiled.Model;
+using DotTiled.Model;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Serialization/TestData/Map/default-map/default-map.cs b/src/DotTiled.Tests/Serialization/TestData/Map/default-map/default-map.cs
index c445069..4eef6de 100644
--- a/src/DotTiled.Tests/Serialization/TestData/Map/default-map/default-map.cs
+++ b/src/DotTiled.Tests/Serialization/TestData/Map/default-map/default-map.cs
@@ -1,5 +1,5 @@
using DotTiled.Model;
-using DotTiled.Model.Layers;
+using DotTiled.Model;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Serialization/TestData/Map/map-external-tileset-multi/map-external-tileset-multi.cs b/src/DotTiled.Tests/Serialization/TestData/Map/map-external-tileset-multi/map-external-tileset-multi.cs
index e1aecda..04c425a 100644
--- a/src/DotTiled.Tests/Serialization/TestData/Map/map-external-tileset-multi/map-external-tileset-multi.cs
+++ b/src/DotTiled.Tests/Serialization/TestData/Map/map-external-tileset-multi/map-external-tileset-multi.cs
@@ -1,8 +1,8 @@
using System.Globalization;
using DotTiled.Model;
-using DotTiled.Model.Layers;
-using DotTiled.Model.Properties;
-using DotTiled.Model.Tilesets;
+using DotTiled.Model;
+using DotTiled.Model;
+using DotTiled.Model;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Serialization/TestData/Map/map-external-tileset-wangset/map-external-tileset-wangset.cs b/src/DotTiled.Tests/Serialization/TestData/Map/map-external-tileset-wangset/map-external-tileset-wangset.cs
index 7e21c54..a894a53 100644
--- a/src/DotTiled.Tests/Serialization/TestData/Map/map-external-tileset-wangset/map-external-tileset-wangset.cs
+++ b/src/DotTiled.Tests/Serialization/TestData/Map/map-external-tileset-wangset/map-external-tileset-wangset.cs
@@ -1,7 +1,7 @@
using System.Globalization;
using DotTiled.Model;
-using DotTiled.Model.Layers;
-using DotTiled.Model.Tilesets;
+using DotTiled.Model;
+using DotTiled.Model;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Serialization/TestData/Map/map-with-common-props/map-with-common-props.cs b/src/DotTiled.Tests/Serialization/TestData/Map/map-with-common-props/map-with-common-props.cs
index 7b4de68..14f95ac 100644
--- a/src/DotTiled.Tests/Serialization/TestData/Map/map-with-common-props/map-with-common-props.cs
+++ b/src/DotTiled.Tests/Serialization/TestData/Map/map-with-common-props/map-with-common-props.cs
@@ -1,7 +1,7 @@
using System.Globalization;
using DotTiled.Model;
-using DotTiled.Model.Layers;
-using DotTiled.Model.Properties;
+using DotTiled.Model;
+using DotTiled.Model;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Serialization/TestData/Map/map-with-custom-type-props/map-with-custom-type-props.cs b/src/DotTiled.Tests/Serialization/TestData/Map/map-with-custom-type-props/map-with-custom-type-props.cs
index 47a6b6b..e7d135c 100644
--- a/src/DotTiled.Tests/Serialization/TestData/Map/map-with-custom-type-props/map-with-custom-type-props.cs
+++ b/src/DotTiled.Tests/Serialization/TestData/Map/map-with-custom-type-props/map-with-custom-type-props.cs
@@ -1,8 +1,8 @@
using System.Globalization;
using DotTiled.Model;
-using DotTiled.Model.Layers;
-using DotTiled.Model.Properties;
-using DotTiled.Model.Properties.CustomTypes;
+using DotTiled.Model;
+using DotTiled.Model;
+using DotTiled.Model;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Serialization/TestData/Map/map-with-embedded-tileset/map-with-embedded-tileset.cs b/src/DotTiled.Tests/Serialization/TestData/Map/map-with-embedded-tileset/map-with-embedded-tileset.cs
index 0673cf6..e9c4e73 100644
--- a/src/DotTiled.Tests/Serialization/TestData/Map/map-with-embedded-tileset/map-with-embedded-tileset.cs
+++ b/src/DotTiled.Tests/Serialization/TestData/Map/map-with-embedded-tileset/map-with-embedded-tileset.cs
@@ -1,7 +1,7 @@
using System.Globalization;
using DotTiled.Model;
-using DotTiled.Model.Layers;
-using DotTiled.Model.Tilesets;
+using DotTiled.Model;
+using DotTiled.Model;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Serialization/TestData/Map/map-with-external-tileset/map-with-external-tileset.cs b/src/DotTiled.Tests/Serialization/TestData/Map/map-with-external-tileset/map-with-external-tileset.cs
index efea5c0..055a0c9 100644
--- a/src/DotTiled.Tests/Serialization/TestData/Map/map-with-external-tileset/map-with-external-tileset.cs
+++ b/src/DotTiled.Tests/Serialization/TestData/Map/map-with-external-tileset/map-with-external-tileset.cs
@@ -1,7 +1,7 @@
using System.Globalization;
using DotTiled.Model;
-using DotTiled.Model.Layers;
-using DotTiled.Model.Tilesets;
+using DotTiled.Model;
+using DotTiled.Model;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Serialization/TestData/Map/map-with-flippingflags/map-with-flippingflags.cs b/src/DotTiled.Tests/Serialization/TestData/Map/map-with-flippingflags/map-with-flippingflags.cs
index d2f1813..96995d7 100644
--- a/src/DotTiled.Tests/Serialization/TestData/Map/map-with-flippingflags/map-with-flippingflags.cs
+++ b/src/DotTiled.Tests/Serialization/TestData/Map/map-with-flippingflags/map-with-flippingflags.cs
@@ -1,7 +1,7 @@
using System.Globalization;
using DotTiled.Model;
-using DotTiled.Model.Layers;
-using DotTiled.Model.Tilesets;
+using DotTiled.Model;
+using DotTiled.Model;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Serialization/TestData/Map/map-with-many-layers/map-with-many-layers.cs b/src/DotTiled.Tests/Serialization/TestData/Map/map-with-many-layers/map-with-many-layers.cs
index 2b09178..320fa48 100644
--- a/src/DotTiled.Tests/Serialization/TestData/Map/map-with-many-layers/map-with-many-layers.cs
+++ b/src/DotTiled.Tests/Serialization/TestData/Map/map-with-many-layers/map-with-many-layers.cs
@@ -1,9 +1,9 @@
using System.Numerics;
using DotTiled.Model;
-using DotTiled.Model.Layers;
-using DotTiled.Model.Layers.Objects;
-using DotTiled.Model.Properties;
-using DotTiled.Model.Tilesets;
+using DotTiled.Model;
+using DotTiled.Model;
+using DotTiled.Model;
+using DotTiled.Model;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Serialization/Tmj/TmjMapReaderTests.cs b/src/DotTiled.Tests/Serialization/Tmj/TmjMapReaderTests.cs
index c862203..a856f68 100644
--- a/src/DotTiled.Tests/Serialization/Tmj/TmjMapReaderTests.cs
+++ b/src/DotTiled.Tests/Serialization/Tmj/TmjMapReaderTests.cs
@@ -1,6 +1,6 @@
using DotTiled.Model;
-using DotTiled.Model.Properties.CustomTypes;
-using DotTiled.Model.Tilesets;
+using DotTiled.Model;
+using DotTiled.Model;
using DotTiled.Serialization.Tmj;
namespace DotTiled.Tests;
diff --git a/src/DotTiled.Tests/Serialization/Tmx/TmxMapReaderTests.cs b/src/DotTiled.Tests/Serialization/Tmx/TmxMapReaderTests.cs
index ab48769..6a26b62 100644
--- a/src/DotTiled.Tests/Serialization/Tmx/TmxMapReaderTests.cs
+++ b/src/DotTiled.Tests/Serialization/Tmx/TmxMapReaderTests.cs
@@ -1,7 +1,7 @@
using System.Xml;
using DotTiled.Model;
-using DotTiled.Model.Properties.CustomTypes;
-using DotTiled.Model.Tilesets;
+using DotTiled.Model;
+using DotTiled.Model;
using DotTiled.Serialization.Tmx;
namespace DotTiled.Tests;
diff --git a/src/DotTiled/DotTiled.csproj b/src/DotTiled/DotTiled.csproj
index 0102e6e..0a2dfe8 100644
--- a/src/DotTiled/DotTiled.csproj
+++ b/src/DotTiled/DotTiled.csproj
@@ -3,6 +3,7 @@
net8.0enable
+ true
diff --git a/src/DotTiled/Model/Color.cs b/src/DotTiled/Model/Color.cs
index 4700e0c..24cf8e5 100644
--- a/src/DotTiled/Model/Color.cs
+++ b/src/DotTiled/Model/Color.cs
@@ -1,22 +1,57 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
+using System.Threading;
namespace DotTiled.Model;
+///
+/// Represents a Tiled color.
+///
public class Color : IParsable, IEquatable
{
+ ///
+ /// The red component of the color.
+ ///
public required byte R { get; set; }
+
+ ///
+ /// The green component of the color.
+ ///
public required byte G { get; set; }
+
+ ///
+ /// The blue component of the color.
+ ///
public required byte B { get; set; }
+
+ ///
+ /// The alpha component of the color.
+ ///
public byte A { get; set; } = 255;
+ ///
+ /// Attempts to parse the specified string into a . Expects strings in the format #RRGGBB or #AARRGGBB.
+ /// The leading # is optional.
+ ///
+ /// A string value to parse into a
+ /// An object that supplies culture-specific information about the format of s.
+ /// The parsed
+ /// Thrown in case the provided string is not in a valid format.
public static Color Parse(string s, IFormatProvider? provider)
{
TryParse(s, provider, out var result);
return result ?? throw new FormatException($"Invalid format for TiledColor: {s}");
}
+ ///
+ /// Attempts to parse the specified string into a . Expects strings in the format #RRGGBB or #AARRGGBB.
+ /// The leading # is optional.
+ ///
+ /// A string value to parse into a
+ /// An object that supplies culture-specific information about the format of s.
+ /// When this method returns, contains the parsed or null on failure.
+ /// true if was successfully parsed; otherwise, false.
public static bool TryParse(
[NotNullWhen(true)] string? s,
IFormatProvider? provider,
@@ -55,6 +90,7 @@ public class Color : IParsable, IEquatable
return true;
}
+ ///
public bool Equals(Color? other)
{
if (other is null)
@@ -63,9 +99,12 @@ public class Color : IParsable, IEquatable
return R == other.R && G == other.G && B == other.B && A == other.A;
}
+ ///
public override bool Equals(object? obj) => obj is Color other && Equals(other);
+ ///
public override int GetHashCode() => HashCode.Combine(R, G, B, A);
+ ///
public override string ToString() => $"#{A:x2}{R:x2}{G:x2}{B:x2}";
}
diff --git a/src/DotTiled/Model/Layers/BaseLayer.cs b/src/DotTiled/Model/Layers/BaseLayer.cs
index adeee69..aa78191 100644
--- a/src/DotTiled/Model/Layers/BaseLayer.cs
+++ b/src/DotTiled/Model/Layers/BaseLayer.cs
@@ -1,22 +1,66 @@
using System.Collections.Generic;
-using DotTiled.Model.Properties;
-namespace DotTiled.Model.Layers;
+namespace DotTiled.Model;
+///
+/// Base class for all layer types in a map.
+/// To check the type of a layer, use C# pattern matching,
+/// or some other mechanism to determine the type of the layer at runtime.
+///
public abstract class BaseLayer
{
- // Attributes
+ ///
+ /// Unique ID of the layer. Each layer that is added to a map gets a unique ID. Even if a layer is deleted, no layer ever gets the same ID.
+ ///
public required uint ID { get; set; }
+
+ ///
+ /// The name of the layer.
+ ///
public string Name { get; set; } = "";
+
+ ///
+ /// The class of the layer.
+ ///
public string Class { get; set; } = "";
+
+ ///
+ /// The opacity of the layer as a value from 0 (fully transparent) to 1 (fully opaque).
+ ///
public float Opacity { get; set; } = 1.0f;
+
+ ///
+ /// Whether the layer is shown (true) or hidden (false).
+ ///
public bool Visible { get; set; } = true;
+
+ ///
+ /// A tint color that is multiplied with any tiles drawn by this layer.
+ ///
public Color? TintColor { get; set; }
+
+ ///
+ /// Horizontal offset for this layer in pixels.
+ ///
public float OffsetX { get; set; } = 0.0f;
+
+ ///
+ /// Vertical offset for this layer in pixels.
+ ///
public float OffsetY { get; set; } = 0.0f;
+
+ ///
+ /// Horizontal parallax factor for this layer.
+ ///
public float ParallaxX { get; set; } = 1.0f;
+
+ ///
+ /// Vertical parallax factor for this layer.
+ ///
public float ParallaxY { get; set; } = 1.0f;
- // At most one of
+ ///
+ /// Layer properties.
+ ///
public Dictionary? Properties { get; set; }
}
diff --git a/src/DotTiled/Model/Layers/Data.cs b/src/DotTiled/Model/Layers/Data.cs
index 2d54020..d2a9686 100644
--- a/src/DotTiled/Model/Layers/Data.cs
+++ b/src/DotTiled/Model/Layers/Data.cs
@@ -1,51 +1,144 @@
using System;
-namespace DotTiled.Model.Layers;
+namespace DotTiled.Model;
+///
+/// Specifies the encoding used to encode the tile layer data.
+///
public enum DataEncoding
{
+ ///
+ /// The data is stored as comma-separated values.
+ ///
Csv,
+
+ ///
+ /// The data is stored as base64-encoded binary data.
+ ///
Base64
}
+///
+/// Specifies the compression algorithm used to compress the tile layer data.
+///
public enum DataCompression
{
+ ///
+ /// GZip compression.
+ ///
GZip,
+
+ ///
+ /// ZLib compression.
+ ///
ZLib,
+
+ ///
+ /// ZStandard compression. Currently not supported by DotTiled and will throw an exception if encountered.
+ ///
ZStd
}
+///
+/// The flipping flags for a tile. These can be used to check how a tile is flipped or rotated. Uses the
+/// FlagsAttribute, for which there is plenty of documentation.
+///
[Flags]
public enum FlippingFlags : uint
{
+ ///
+ /// No flipping.
+ ///
None = 0,
+
+ ///
+ /// The tile is flipped horizontally.
+ ///
FlippedHorizontally = 0x80000000u,
+
+ ///
+ /// The tile is flipped vertically.
+ ///
FlippedVertically = 0x40000000u,
+
+ ///
+ /// The tile is flipped diagonally.
+ ///
FlippedDiagonally = 0x20000000u,
+
+ ///
+ /// In hexagonal maps, the tile is rotated 120 degrees clockwise.
+ ///
RotatedHexagonal120 = 0x10000000u
}
+///
+/// Represents part of a tile layer of a map that is infinite.
+///
public class Chunk
{
- // Attributes
+ ///
+ /// The X coordinate of the chunk in tiles.
+ ///
public required int X { get; set; }
+
+ ///
+ /// The Y coordinate of the chunk in tiles.
+ ///
public required int Y { get; set; }
+
+ ///
+ /// The width of the chunk in tiles.
+ ///
public required uint Width { get; set; }
+
+ ///
+ /// The height of the chunk in tiles.
+ ///
public required uint Height { get; set; }
- // Data
+ ///
+ /// The parsed chunk data, as a list of tile GIDs.
+ /// To get an actual tile ID, you map it to a local tile ID using the correct tileset. Please refer to
+ /// the documentation on how to do this.
+ ///
public required uint[] GlobalTileIDs { get; set; }
+
+ ///
+ /// The parsed flipping flags for each tile in the chunk. Appear in the same order as the tiles in the layer in .
+ ///
public required FlippingFlags[] FlippingFlags { get; set; }
}
+///
+/// Represents the data of a tile layer.
+///
public class Data
{
- // Attributes
+ ///
+ /// The encoding used to encode the tile layer data.
+ ///
public DataEncoding? Encoding { get; set; }
+
+ ///
+ /// The compression method used to compress the tile layer data.
+ ///
public DataCompression? Compression { get; set; }
- // Data
+ ///
+ /// The parsed tile layer data, as a list of tile GIDs.
+ /// To get an actual tile ID, you map it to a local tile ID using the correct tileset. Please refer to
+ /// the documentation on how to do this.
+ ///
public uint[]? GlobalTileIDs { get; set; }
+
+ ///
+ /// The parsed flipping flags for each tile in the layer. Appear in the same order as the tiles in the layer in .
+ ///
public FlippingFlags[]? FlippingFlags { get; set; }
+
+ ///
+ /// If the map is infinite, it will instead contain a list of chunks.
+ ///
public Chunk[]? Chunks { get; set; }
}
diff --git a/src/DotTiled/Model/Layers/Group.cs b/src/DotTiled/Model/Layers/Group.cs
index fd89f61..f770c63 100644
--- a/src/DotTiled/Model/Layers/Group.cs
+++ b/src/DotTiled/Model/Layers/Group.cs
@@ -1,11 +1,14 @@
using System.Collections.Generic;
-namespace DotTiled.Model.Layers;
+namespace DotTiled.Model;
+///
+/// Represents a group of layers, to form a hierarchy.
+///
public class Group : BaseLayer
{
- // Uses same attributes as BaseLayer
-
- // Any number of
+ ///
+ /// The contained sub-layers in the group.
+ ///
public List Layers { get; set; } = [];
}
diff --git a/src/DotTiled/Model/Layers/ImageLayer.cs b/src/DotTiled/Model/Layers/ImageLayer.cs
index cd35a41..e0bb110 100644
--- a/src/DotTiled/Model/Layers/ImageLayer.cs
+++ b/src/DotTiled/Model/Layers/ImageLayer.cs
@@ -1,15 +1,32 @@
-using DotTiled.Model.Tilesets;
-
-namespace DotTiled.Model.Layers;
+namespace DotTiled.Model;
+///
+/// Represents an image layer in a map.
+///
public class ImageLayer : BaseLayer
{
- // Attributes
+ ///
+ /// The X position of the image layer in pixels.
+ ///
public uint X { get; set; } = 0;
+
+ ///
+ /// The Y position of the image layer in pixels.
+ ///
public uint Y { get; set; } = 0;
+
+ ///
+ /// Whether the image drawn by this layer is repeated along the X axis.
+ ///
public bool RepeatX { get; set; } = false;
+
+ ///
+ /// Whether the image drawn by this layer is repeated along the Y axis.
+ ///
public bool RepeatY { get; set; } = false;
- // At most one of
+ ///
+ /// The image to be drawn by this image layer.
+ ///
public Image? Image { get; set; }
}
diff --git a/src/DotTiled/Model/Layers/ObjectLayer.cs b/src/DotTiled/Model/Layers/ObjectLayer.cs
index 817e95e..60acc13 100644
--- a/src/DotTiled/Model/Layers/ObjectLayer.cs
+++ b/src/DotTiled/Model/Layers/ObjectLayer.cs
@@ -1,24 +1,60 @@
using System.Collections.Generic;
-using DotTiled.Model.Layers.Objects;
-namespace DotTiled.Model.Layers;
+namespace DotTiled.Model;
+///
+/// Represents the order in which objects can be drawn.
+///
public enum DrawOrder
{
+ ///
+ /// Objects are drawn sorted by their Y coordinate.
+ ///
TopDown,
+
+ ///
+ /// Objects are drawn in the order of appearance in the object layer.
+ ///
Index
}
+///
+/// Represents an object layer in a map. In Tiled documentation, it is often called an "object group".
+///
public class ObjectLayer : BaseLayer
{
- // Attributes
+ ///
+ /// The X coordinate of the object layer in tiles.
+ ///
public uint X { get; set; } = 0;
+
+ ///
+ /// The Y coordinate of the object layer in tiles.
+ ///
public uint Y { get; set; } = 0;
+
+ ///
+ /// The width of the object layer in tiles. Meaningless.
+ ///
public uint? Width { get; set; }
+
+ ///
+ /// The height of the object layer in tiles. Meaningless.
+ ///
public uint? Height { get; set; }
+
+ ///
+ /// A color that is multiplied with any tile objects drawn by this layer.
+ ///
public Color? Color { get; set; }
+
+ ///
+ /// Whether the objects are drawn according to the order of appearance () or sorted by their Y coordinate ().
+ ///
public DrawOrder DrawOrder { get; set; } = DrawOrder.TopDown;
- // Elements
+ ///
+ /// The objects in the object layer.
+ ///
public required List