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
Gondwana.Configuration.EngineConfigurationFile Class Reference

Represents a configuration file for the engine, providing functionality to create, load, and save engine settings. More...

Inheritance diagram for Gondwana.Configuration.EngineConfigurationFile:
Gondwana.Configuration.IEngineConfigurationStore

Public Member Functions

void Save ()
 Saves the configuration to the file specified by FilePath.
void Save (string jsonPath)
 Saves the configuration to the specified file path.
void Dispose ()
 Releases all resources used by the EngineConfigurationFile.

Static Public Member Functions

static EngineConfigurationFile CreateNew (string? configFileName=null, bool? autoSave=null)
 Creates a new engine configuration file with default settings.
static EngineConfigurationFile Load (string? configFileName=null, bool? autoSave=null)
 Loads an engine configuration file from disk.

Properties

string FileName [get]
 Gets the name of the configuration file without the directory path.
string FilePath [get]
 Gets the full path to the configuration file.
bool AutoSave = false [get, set]
 Gets or sets a value indicating whether the configuration should be automatically saved when the instance is disposed.
EngineConfiguration EngineConfig = new() [get]
 Gets the engine configuration settings.
EngineConfiguration Configuration [get]
 Gets the engine configuration represented by this file-backed store.

Detailed Description

Represents a configuration file for the engine, providing functionality to create, load, and save engine settings.

This class manages the persistence of EngineConfiguration to and from a JSON file. It supports automatic saving on disposal and can be created from scratch or loaded from an existing file.

Definition at line 12 of file EngineConfigurationFile.cs.

Member Function Documentation

◆ CreateNew()

EngineConfigurationFile Gondwana.Configuration.EngineConfigurationFile.CreateNew ( string? configFileName = null,
bool? autoSave = null )
static

Creates a new engine configuration file with default settings.

Parameters
configFileNameThe name of the configuration file to create. If null, uses the default file name "gondwana.json".
autoSaveA value indicating whether the configuration should be automatically saved when disposed. If null, defaults to false.
Returns
A new EngineConfigurationFile instance with default engine configuration settings.

Definition at line 26 of file EngineConfigurationFile.cs.

◆ Dispose()

void Gondwana.Configuration.EngineConfigurationFile.Dispose ( )

Releases all resources used by the EngineConfigurationFile.

If AutoSave is true, the configuration is automatically saved before disposal.

Definition at line 123 of file EngineConfigurationFile.cs.

◆ Load()

EngineConfigurationFile Gondwana.Configuration.EngineConfigurationFile.Load ( string? configFileName = null,
bool? autoSave = null )
static

Loads an engine configuration file from disk.

If the specified file does not exist or cannot be read, a new configuration with default settings is created. The configuration file is monitored for changes and will reload automatically when modified.

Parameters
configFileNameThe name of the configuration file to load. If null, uses the default file name "gondwana.json".
autoSaveA value indicating whether the configuration should be automatically saved when disposed. If null, defaults to false.
Returns
An EngineConfigurationFile instance loaded from the specified file, or a new instance with default settings if the file doesn't exist.

Definition at line 46 of file EngineConfigurationFile.cs.

◆ Save() [1/2]

void Gondwana.Configuration.EngineConfigurationFile.Save ( )

Saves the configuration to the file specified by FilePath.

The configuration is serialized to JSON with indented formatting for readability.

Implements Gondwana.Configuration.IEngineConfigurationStore.

Definition at line 101 of file EngineConfigurationFile.cs.

◆ Save() [2/2]

void Gondwana.Configuration.EngineConfigurationFile.Save ( string jsonPath)

Saves the configuration to the specified file path.

The configuration is serialized to JSON with indented formatting. After saving, the FileName property is updated to reflect the new path.

Parameters
jsonPathThe full path where the configuration file should be saved.

Definition at line 112 of file EngineConfigurationFile.cs.

Property Documentation

◆ AutoSave

bool Gondwana.Configuration.EngineConfigurationFile.AutoSave = false
getset

Gets or sets a value indicating whether the configuration should be automatically saved when the instance is disposed.

When set to true, the Save() method is automatically called during disposal.

Implements Gondwana.Configuration.IEngineConfigurationStore.

Definition at line 84 of file EngineConfigurationFile.cs.

◆ Configuration

EngineConfiguration Gondwana.Configuration.EngineConfigurationFile.Configuration
get

Gets the engine configuration represented by this file-backed store.

Implements Gondwana.Configuration.IEngineConfigurationStore.

Definition at line 95 of file EngineConfigurationFile.cs.

◆ EngineConfig

EngineConfiguration Gondwana.Configuration.EngineConfigurationFile.EngineConfig = new()
get

Gets the engine configuration settings.

Definition at line 89 of file EngineConfigurationFile.cs.

◆ FileName

string Gondwana.Configuration.EngineConfigurationFile.FileName
get

Gets the name of the configuration file without the directory path.

Definition at line 67 of file EngineConfigurationFile.cs.

◆ FilePath

string Gondwana.Configuration.EngineConfigurationFile.FilePath
get

Gets the full path to the configuration file.

Definition at line 77 of file EngineConfigurationFile.cs.