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
SpriteDefinitionSource.cs
1using Newtonsoft.Json;
2
4
8public sealed class SpriteDefinitionSource
9{
10 [JsonConstructor]
11 private SpriteDefinitionSource() { }
12
16 [JsonProperty]
17 public SpriteDefinitionSourceKind Kind { get; private init; }
18
22 [JsonProperty]
23 public string? GsprFilePath { get; private init; }
24
28 [JsonProperty]
29 public string? AssetsFilePath { get; private init; }
30
34 [JsonProperty]
35 public string? AssetEntryName { get; private init; }
36
42 public static SpriteDefinitionSource LooseDefinitionFile(string gsprFilePath)
43 {
44 if (string.IsNullOrWhiteSpace(gsprFilePath))
45 throw new ArgumentException("GSPR file path must be a non-empty string.", nameof(gsprFilePath));
46
47 return new SpriteDefinitionSource
48 {
49 Kind = SpriteDefinitionSourceKind.LooseDefinitionFile,
50 GsprFilePath = gsprFilePath
51 };
52 }
53
60 public static SpriteDefinitionSource PackedDefinitionFile(string assetsFilePath, string assetEntryName)
61 {
62 if (string.IsNullOrWhiteSpace(assetsFilePath))
63 throw new ArgumentException("Assets file path must be a non-empty string.", nameof(assetsFilePath));
64
65 if (string.IsNullOrWhiteSpace(assetEntryName))
66 throw new ArgumentException("Asset entry name must be a non-empty string.", nameof(assetEntryName));
67
68 return new SpriteDefinitionSource
69 {
70 Kind = SpriteDefinitionSourceKind.PackedDefinitionFile,
71 AssetsFilePath = assetsFilePath,
72 AssetEntryName = assetEntryName
73 };
74 }
75
80 public static SpriteDefinitionSource Generated() =>
81 new()
82 {
84 };
85
90 public static SpriteDefinitionSource None() =>
91 new()
92 {
94 };
95}
string? GsprFilePath
Gets the .gspr path when loaded from a loose definition file.
static SpriteDefinitionSource None()
Creates an empty source marker when no provenance is known.
SpriteDefinitionSourceKind Kind
Gets the high-level source kind.
static SpriteDefinitionSource PackedDefinitionFile(string assetsFilePath, string assetEntryName)
Creates a source marker for a packed .gspr entry inside an assets file.
string? AssetEntryName
Gets the packed entry name when loaded from a packed definition file.
static SpriteDefinitionSource Generated()
Creates a source marker for a definition generated from runtime state or tooling.
static SpriteDefinitionSource LooseDefinitionFile(string gsprFilePath)
Creates a source marker for a loose .gspr file.
string? AssetsFilePath
Gets the .gaf path when loaded from a packed definition file.
SpriteDefinitionSourceKind
Indicates where a scene definition came from.
@ Generated
The definition was generated from runtime state.