![]() |
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.
|
Represents an asset file used by the engine, providing functionality to load, manage, and save assets. More...
Public Member Functions | |
| void | Add (AssetTypes type, string name, Func< Stream > streamFactory) |
| Adds an asset file entry to the collection with the specified type, name, and stream factory. | |
| void | Add (AssetTypes type, string filePath, string? name=null) |
| Adds an asset file to the engine with the specified type and file path. | |
| void | Add (AssetTypes type, string name, Stream stream) |
| Adds an asset file entry to the collection with the specified type, name, and source stream. | |
| void | Remove (AssetTypes type, string name) |
| Removes the specified asset file entry from the collection. | |
| Stream? | Get (AssetTypes type, string name) |
| Retrieves a stream for the specified asset type and name. | |
| IEnumerable< AssetsFileEntry > | GetAllEntries () |
| Retrieves all entries from the asset file. | |
| void | Save () |
| Saves the current set of entries to a zip file at the specified file path. | |
| void | Dispose () |
| Releases all resources used by the AssetsFile instance. | |
Static Public Member Functions | |
| static void | ClearAll () |
| Releases all assets held by the application and clears the internal collection of asset files. | |
| static void | Validate (string path, string? password=null, bool testData=true) |
| Strictly validates an existing bundle's entry keys and archive integrity. Unlike runtime loading, rejects unrecognized and duplicate entries. | |
| static AssetsFile | LoadOrCreate (string path, string? password=null, bool encrypt=false) |
| Loads an existing asset file from the specified path or creates a new one if the file does not exist. | |
| static AssetsFile | LoadOrCreate (string path, string? password, bool encrypt, bool register) |
| Loads or creates an asset file, optionally without adding it to the runtime collection. Authoring hosts can own detached packages without changing runtime state. | |
| static AssetsFile | Load (Stream stream, string? password=null, bool register=true) |
| Loads an existing asset file from a readable stream. | |
| static AssetsFile | Load (Stream stream, string? password, bool register, string? sourcePath) |
| Loads a buffered archive with an optional reconstructible source path. | |
Properties | |
| static IReadOnlyList< AssetsFile > | AllAssetsFiles [get] |
| Gets a read-only list of registered AssetsFile instances. | |
| string | FilePath = string.Empty [get] |
| Gets the file path associated with the current instance. | |
| string? | Password [get] |
| Gets the password associated with the current instance. | |
| bool | UseEncryption [get] |
| Gets a value indicating whether encryption is enabled for the current operation. | |
| string? | SourcePath [get] |
| Gets the archive's reconstructible origin, including an optional stream origin. | |
| Stream? | this[AssetTypes type, string name] [get] |
| Gets the stream associated with the specified asset type and name. | |
Represents an asset file used by the engine, providing functionality to load, manage, and save assets.
The AssetsFile class allows for the creation, loading, and management of asset files used by the engine. It supports encryption, asset retrieval by type and name, and saving assets to a zip file. Instances are registered by default and can be accessed via the static AllAssetsFiles property.
Definition at line 17 of file AssetsFile.cs.
| void Gondwana.Assets.AssetsFile.Add | ( | AssetTypes | type, |
| string | filePath, | ||
| string? | name = null ) |
Adds an asset file to the engine with the specified type and file path.
The asset is stored using its full file name, including extension, unless an explicit name is provided.
| type | The type of the asset file to add. |
| filePath | The full path to the asset file. Must not be null or empty. |
| name | The name to use for the asset file. If null, the file name will be used. |
Definition at line 320 of file AssetsFile.cs.
| void Gondwana.Assets.AssetsFile.Add | ( | AssetTypes | type, |
| string | name, | ||
| Func< Stream > | streamFactory ) |
Adds an asset file entry to the collection with the specified type, name, and stream factory.
If an entry with the same type and name already exists, it will be replaced with the new stream data. The provided factory is invoked immediately and its contents are buffered in memory.
| type | The type of the asset file to add. |
| name | The name of the asset file to add. Cannot be null or empty. |
| streamFactory | A factory method that provides a Stream for the asset file. |
Definition at line 300 of file AssetsFile.cs.
| void Gondwana.Assets.AssetsFile.Add | ( | AssetTypes | type, |
| string | name, | ||
| Stream | stream ) |
Adds an asset file entry to the collection with the specified type, name, and source stream.
The provided stream is read immediately and buffered in memory. Subsequent access returns a new read-only stream over the buffered bytes.
| type | The type of the asset file to add. |
| name | The name of the asset file to add. Cannot be null or empty. |
| stream | The source stream containing the asset data. Must be readable. |
| ArgumentNullException | Thrown if stream is null. |
| ArgumentException | Thrown if name is null or empty. |
Definition at line 342 of file AssetsFile.cs.
|
static |
Releases all assets held by the application and clears the internal collection of asset files.
Definition at line 29 of file AssetsFile.cs.
| void Gondwana.Assets.AssetsFile.Dispose | ( | ) |
Releases all resources used by the AssetsFile instance.
Definition at line 494 of file AssetsFile.cs.
| Stream? Gondwana.Assets.AssetsFile.Get | ( | AssetTypes | type, |
| string | name ) |
Retrieves a stream for the specified asset type and name.
Attempts exact match first, then falls back to base-name matching without extension.
| type | The type of the asset to retrieve. |
| name | The name of the asset to retrieve. May include or omit the file extension. |
null. Definition at line 406 of file AssetsFile.cs.
| IEnumerable< AssetsFileEntry > Gondwana.Assets.AssetsFile.GetAllEntries | ( | ) |
Retrieves all entries from the asset file.
Definition at line 440 of file AssetsFile.cs.
|
static |
Loads a buffered archive with an optional reconstructible source path.
| stream | The readable archive stream. |
| password | The optional archive password. |
| register | Whether to register the archive. |
| sourcePath | A path identifying the stream origin. Does not open or write that path. |
Definition at line 144 of file AssetsFile.cs.
|
static |
Loads an existing asset file from a readable stream.
The stream is consumed immediately and is not retained or disposed by the returned AssetsFile. Archive contents are buffered in memory, so the caller may dispose the source stream as soon as this method returns.
| stream | The stream containing the GAF archive. |
| password | The optional archive password. |
| register | Whether to add this instance to AllAssetsFiles. |
|
static |
Loads or creates an asset file, optionally without adding it to the runtime collection. Authoring hosts can own detached packages without changing runtime state.
| path | The asset file path to load or create. |
| password | The optional archive password. |
| encrypt | Whether saves use encryption. |
| register | Whether to add this instance to AllAssetsFiles. |
Definition at line 96 of file AssetsFile.cs.
|
static |
Loads an existing asset file from the specified path or creates a new one if the file does not exist.
| path | The file path of the asset file to load or create. Cannot be null, empty, or whitespace. |
| password | An optional password used to secure the asset file. Can be null if no password is required. |
| encrypt | A value indicating whether the asset file should use encryption. Defaults to false. |
| ArgumentException | Thrown if path is null, empty, or consists only of whitespace. |
| void Gondwana.Assets.AssetsFile.Remove | ( | AssetTypes | type, |
| string | name ) |
Removes the specified asset file entry from the collection.
| type | The type of the asset file to remove. |
| name | The name of the asset file to remove. Cannot be null or empty. |
Definition at line 371 of file AssetsFile.cs.
| void Gondwana.Assets.AssetsFile.Save | ( | ) |
Saves the current set of entries to a zip file at the specified file path.
Definition at line 449 of file AssetsFile.cs.
|
static |
Strictly validates an existing bundle's entry keys and archive integrity. Unlike runtime loading, rejects unrecognized and duplicate entries.
| path | Existing bundle to inspect. |
| password | Optional password for protected entries. |
| testData | Whether to decompress and verify all payload data; false checks structure and keys only. |
Definition at line 50 of file AssetsFile.cs.
|
staticget |
Gets a read-only list of registered AssetsFile instances.
Definition at line 24 of file AssetsFile.cs.
|
get |
Gets the file path associated with the current instance.
Definition at line 172 of file AssetsFile.cs.
|
get |
Gets the password associated with the current instance.
Definition at line 178 of file AssetsFile.cs.
|
get |
Gets the archive's reconstructible origin, including an optional stream origin.
File-backed archives use FilePath. Anonymous streams have no source path.
Definition at line 189 of file AssetsFile.cs.
|
get |
Gets the stream associated with the specified asset type and name.
| type | The type of the asset file to retrieve. |
| name | The name of the asset within the specified type. |
null.Definition at line 393 of file AssetsFile.cs.
|
get |
Gets a value indicating whether encryption is enabled for the current operation.
Definition at line 184 of file AssetsFile.cs.