Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
TilesheetDefinitionSource.cs
1using Newtonsoft.Json;
2
4
8public sealed class TilesheetDefinitionSource
9{
10 [JsonConstructor]
11 private TilesheetDefinitionSource() { }
12
16 [JsonProperty]
17 public TilesheetDefinitionSourceKind Kind { get; private init; }
18
22 [JsonProperty]
23 public string? GtsFilePath { get; private init; }
24
28 [JsonProperty]
29 public string? AssetsFilePath { get; private init; }
30
34 [JsonProperty]
35 public string? AssetEntryName { get; private init; }
36
43 public static TilesheetDefinitionSource LooseDefinitionFile(string gtsFilePath)
44 {
45 if (string.IsNullOrWhiteSpace(gtsFilePath))
46 throw new ArgumentException("GTS file path must be a non-empty string.", nameof(gtsFilePath));
47
48 return new TilesheetDefinitionSource
49 {
50 Kind = TilesheetDefinitionSourceKind.LooseDefinitionFile,
51 GtsFilePath = gtsFilePath
52 };
53 }
54
62 public static TilesheetDefinitionSource PackedDefinitionFile(string assetsFilePath, string assetEntryName)
63 {
64 if (string.IsNullOrWhiteSpace(assetsFilePath))
65 throw new ArgumentException("Assets file path must be a non-empty string.", nameof(assetsFilePath));
66
67 if (string.IsNullOrWhiteSpace(assetEntryName))
68 throw new ArgumentException("Asset entry name must be a non-empty string.", nameof(assetEntryName));
69
70 return new TilesheetDefinitionSource
71 {
72 Kind = TilesheetDefinitionSourceKind.PackedDefinitionFile,
73 AssetsFilePath = assetsFilePath,
74 AssetEntryName = assetEntryName
75 };
76 }
77
82 public static TilesheetDefinitionSource Generated() =>
83 new()
84 {
86 };
87
92 public static TilesheetDefinitionSource None() =>
93 new()
94 {
96 };
97}
TilesheetDefinitionSourceKind Kind
Gets the high-level source kind.
string? AssetEntryName
Gets the packed entry name when loaded from a packed definition file.
static TilesheetDefinitionSource None()
Creates an empty source marker when no provenance is known.
static TilesheetDefinitionSource PackedDefinitionFile(string assetsFilePath, string assetEntryName)
Creates a source marker for a packed .gts entry inside an assets file.
string? AssetsFilePath
Gets the .gaf path when loaded from a packed definition file.
string? GtsFilePath
Gets the .gts path when loaded from a loose definition file.
static TilesheetDefinitionSource Generated()
Creates a source marker for definitions generated by tooling.
static TilesheetDefinitionSource LooseDefinitionFile(string gtsFilePath)
Creates a source marker for a loose .gts file.
TilesheetDefinitionSourceKind
Indicates where a tilesheet definition came from.