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