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.Hosting.GameHostBase Class Referenceabstract

Provides a base class for hosting and managing the lifecycle of a Gondwana game application. More...

Inheritance diagram for Gondwana.Hosting.GameHostBase:
Gondwana.Avalonia.Hosting.AvaloniaBitmapGameHost Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost Gondwana.Blazor.Hosting.BlazorGameHostBase Gondwana.WinForms.Hosting.WinFormsGameHostBase Gondwana.Blazor.Hosting.BlazorGameHost Gondwana.Blazor.Hosting.BlazorGpuGameHost Gondwana.WinForms.Hosting.WinFormsGameHost Gondwana.WinForms.Hosting.WinFormsGpuGameHost

Public Member Functions

void Initialize (string? configPath=null, bool? autoSaveConfig=null, LogLevel logLevel=LogLevel.Warning)
 Initializes the game host by configuring logging, platform services, input, game content, and the Gondwana engine.
void InitializeWithConfigurationStore (IEngineConfigurationStore configurationStore, bool? autoSaveConfig=null, LogLevel logLevel=LogLevel.Warning)
 Initializes the game host using a caller-supplied configuration persistence store.
void Dispose ()
 Releases resources owned by the game host.

Protected Member Functions

void InitializeWidgetInput (RenderSurfaceHostBase renderSurfaceHost)
 Initializes widget input routing for the supplied render surface host.
virtual void OnInitializing ()
 Runs before the host initialization sequence begins.
void ConfigureLogging (LogLevel logLevel)
 Configures the logging level used by Gondwana.
void ConfigurePlatform ()
 Configures platform-specific services, adapters, and render infrastructure.
void ConfigureInput ()
 Configures keyboard, mouse, gamepad, and touch input.
virtual void ConfigureKeyboard ()
 Configures the keyboard input adapter.
virtual void ConfigureMouse ()
 Configures the mouse input adapter.
virtual void ConfigureGamepads ()
 Configures the gamepad manager.
virtual void ConfigureTouch ()
 Configures the touch input adapter.
virtual void OnInputConfigured ()
 Runs after all input devices have been configured.
void InitializeGameContent ()
 Initializes game-specific content, the scene graph, and scene objects.
void LoadContent ()
 Loads assets, tilesheets, and animation cycles.
virtual void LoadAssets ()
 Loads textures, sounds, and other game assets.
virtual void LoadTilesheets ()
 Loads tilesheet definitions.
virtual void LoadAnimationCycles ()
 Loads animation cycle definitions.
void CreateSceneGraph ()
 Creates the initial scene and its views.
virtual void OnSceneGraphCreated ()
 Runs after the scene graph has been created but before the scene is bound.
virtual Scene CreateInitialScene ()
 Creates the initial scene for the game.
virtual void CreateInitialViews ()
 Creates the initial views and viewports used to render the scene.
virtual void BindScene ()
 Binds the current scene to the platform render surface.
virtual void OnSceneBound ()
 Runs after the current scene has been bound to the render surface host.
void InitializeSceneObjects ()
 Creates sprites and direct drawings for the current scene.
virtual void CreateSprites ()
 Creates sprite objects for the current scene.
virtual void CreateDirectDrawings ()
 Creates direct drawings and widgets for the current scene.
void InitializeEngine (string? configPath, bool? autoSaveConfig)
 Initializes the Gondwana engine using the default file-backed configuration store.
void InitializeEngine (string? configPath, bool? autoSaveConfig, IEngineConfigurationStore? configurationStore)
 Initializes the Gondwana engine.
virtual void OnEngineInitialized ()
 Runs after the engine has been initialized but before it has been started.
void StartEngine ()
 Starts the engine using the synchronization context returned by GetSynchronizationContext.
virtual void StartEngineCore (SynchronizationContext syncContext)
 Starts the engine using the supplied synchronization context.
virtual ? SynchronizationContext GetSynchronizationContext ()
 Gets the synchronization context used to start the engine.
virtual void OnEngineStarted ()
 Runs after the engine has been started.
virtual void OnInitialized ()
 Runs after the full host initialization sequence has completed.
virtual void UnhookEvents ()
 Unhooks custom event handlers during disposal.
void StopEngine ()
 Stops the engine during host disposal.
virtual void StopEngineCore ()
 Performs platform-specific engine shutdown work.
void DisposeEngine ()
 Disposes the engine instance.
virtual void OnDisposing ()
 Runs before managed resources are disposed.
virtual void OnDisposed ()
 Runs after managed resources have been disposed.
void EnsureNotInitialized ()
 Ensures that the host has not already been initialized.
void EnsureNotDisposed ()
 Ensures that the host has not been disposed.

Properties

Engine Engine [get]
 Gets the singleton instance of the Gondwana engine.
Scene? Scene [get, protected set]
 Gets the current active scene.
WidgetInputRouter? WidgetInputRouter [get]
 Gets the widget input router, if widget input has been initialized.

Detailed Description

Provides a base class for hosting and managing the lifecycle of a Gondwana game application.

Definition at line 13 of file GameHostBase.cs.

Member Function Documentation

◆ BindScene()

virtual void Gondwana.Hosting.GameHostBase.BindScene ( )
protectedvirtual

◆ ConfigureGamepads()

virtual void Gondwana.Hosting.GameHostBase.ConfigureGamepads ( )
protectedvirtual

◆ ConfigureInput()

void Gondwana.Hosting.GameHostBase.ConfigureInput ( )
protected

Configures keyboard, mouse, gamepad, and touch input.

Definition at line 163 of file GameHostBase.cs.

◆ ConfigureKeyboard()

virtual void Gondwana.Hosting.GameHostBase.ConfigureKeyboard ( )
protectedvirtual

◆ ConfigureLogging()

void Gondwana.Hosting.GameHostBase.ConfigureLogging ( LogLevel logLevel)
protected

Configures the logging level used by Gondwana.

Parameters
logLevelThe minimum log level to use.

Definition at line 149 of file GameHostBase.cs.

◆ ConfigureMouse()

virtual void Gondwana.Hosting.GameHostBase.ConfigureMouse ( )
protectedvirtual

◆ ConfigurePlatform()

void Gondwana.Hosting.GameHostBase.ConfigurePlatform ( )
abstractprotected

Configures platform-specific services, adapters, and render infrastructure.

◆ ConfigureTouch()

virtual void Gondwana.Hosting.GameHostBase.ConfigureTouch ( )
protectedvirtual

◆ CreateDirectDrawings()

virtual void Gondwana.Hosting.GameHostBase.CreateDirectDrawings ( )
protectedvirtual

Creates direct drawings and widgets for the current scene.

Definition at line 327 of file GameHostBase.cs.

◆ CreateInitialScene()

virtual Scene Gondwana.Hosting.GameHostBase.CreateInitialScene ( )
protectedvirtual

Creates the initial scene for the game.

Returns
The initial scene.

Definition at line 282 of file GameHostBase.cs.

◆ CreateInitialViews()

virtual void Gondwana.Hosting.GameHostBase.CreateInitialViews ( )
protectedvirtual

Creates the initial views and viewports used to render the scene.

Definition at line 290 of file GameHostBase.cs.

◆ CreateSceneGraph()

void Gondwana.Hosting.GameHostBase.CreateSceneGraph ( )
protected

Creates the initial scene and its views.

Exceptions
InvalidOperationExceptionThrown when CreateInitialScene returns null.

Definition at line 261 of file GameHostBase.cs.

◆ CreateSprites()

virtual void Gondwana.Hosting.GameHostBase.CreateSprites ( )
protectedvirtual

Creates sprite objects for the current scene.

Definition at line 320 of file GameHostBase.cs.

◆ Dispose()

void Gondwana.Hosting.GameHostBase.Dispose ( )

Releases resources owned by the game host.

Call from the hosting/UI thread, outside an engine callback. Background rendering is stopped and joined before cleanup hooks release native resources.

Definition at line 517 of file GameHostBase.cs.

◆ DisposeEngine()

void Gondwana.Hosting.GameHostBase.DisposeEngine ( )
protected

Disposes the engine instance.

Definition at line 464 of file GameHostBase.cs.

◆ EnsureNotDisposed()

void Gondwana.Hosting.GameHostBase.EnsureNotDisposed ( )
protected

Ensures that the host has not been disposed.

Exceptions
ObjectDisposedExceptionThrown when the host has already been disposed.

Definition at line 505 of file GameHostBase.cs.

◆ EnsureNotInitialized()

void Gondwana.Hosting.GameHostBase.EnsureNotInitialized ( )
protected

Ensures that the host has not already been initialized.

Exceptions
InvalidOperationExceptionThrown when the host has already been initialized.

Definition at line 490 of file GameHostBase.cs.

◆ GetSynchronizationContext()

virtual ? SynchronizationContext Gondwana.Hosting.GameHostBase.GetSynchronizationContext ( )
protectedvirtual

Gets the synchronization context used to start the engine.

Returns
The synchronization context, or null when unavailable.

Reimplemented in Gondwana.Blazor.Hosting.BlazorGameHostBase.

Definition at line 418 of file GameHostBase.cs.

◆ Initialize()

void Gondwana.Hosting.GameHostBase.Initialize ( string? configPath = null,
bool? autoSaveConfig = null,
LogLevel logLevel = LogLevel.Warning )

Initializes the game host by configuring logging, platform services, input, game content, and the Gondwana engine.

Parameters
configPathOptional path to the engine configuration file.
autoSaveConfigOptional value indicating whether configuration changes should be saved automatically.
logLevelThe minimum log level used by Gondwana. The default is LogLevel.Warning.
Exceptions
ObjectDisposedExceptionThrown when the host has already been disposed.
InvalidOperationExceptionThrown when the host has already been initialized or no synchronization context is available.

◆ InitializeEngine() [1/2]

void Gondwana.Hosting.GameHostBase.InitializeEngine ( string? configPath,
bool? autoSaveConfig )
protected

Initializes the Gondwana engine using the default file-backed configuration store.

Retained for compatibility with derived hosts that call the pre-configuration-store overload.

Parameters
configPathOptional path to the engine configuration file.
autoSaveConfigOptional value indicating whether configuration changes should be saved automatically.

◆ InitializeEngine() [2/2]

void Gondwana.Hosting.GameHostBase.InitializeEngine ( string? configPath,
bool? autoSaveConfig,
IEngineConfigurationStore? configurationStore )
protected

Initializes the Gondwana engine.

Parameters
configPathOptional path to the engine configuration file.
autoSaveConfigOptional value indicating whether configuration changes should be saved automatically.
configurationStoreOptional configuration persistence store. When null, the default file-backed store is used.

Definition at line 356 of file GameHostBase.cs.

◆ InitializeGameContent()

void Gondwana.Hosting.GameHostBase.InitializeGameContent ( )
protected

Initializes game-specific content, the scene graph, and scene objects.

Definition at line 215 of file GameHostBase.cs.

◆ InitializeSceneObjects()

void Gondwana.Hosting.GameHostBase.InitializeSceneObjects ( )
protected

Creates sprites and direct drawings for the current scene.

Definition at line 311 of file GameHostBase.cs.

◆ InitializeWidgetInput()

void Gondwana.Hosting.GameHostBase.InitializeWidgetInput ( RenderSurfaceHostBase renderSurfaceHost)
protected

Initializes widget input routing for the supplied render surface host.

Parameters
renderSurfaceHostThe render surface host whose widgets should receive keyboard, mouse, and touch input.

Call this only after the render surface host and the desired input pollers have been created. Reinitializing widget input disposes the previously configured router.

Exceptions
ArgumentNullExceptionThrown when renderSurfaceHost is null.

Definition at line 116 of file GameHostBase.cs.

◆ InitializeWithConfigurationStore()

void Gondwana.Hosting.GameHostBase.InitializeWithConfigurationStore ( IEngineConfigurationStore configurationStore,
bool? autoSaveConfig = null,
LogLevel logLevel = LogLevel::Warning )

Initializes the game host using a caller-supplied configuration persistence store.

Parameters
configurationStoreConfiguration store owned by the engine after successful initialization.
autoSaveConfigOptional override for the store's IEngineConfigurationStore.AutoSave setting.
logLevelThe minimum log level used by Gondwana. The default is LogLevel.Warning.

Definition at line 70 of file GameHostBase.cs.

◆ LoadAnimationCycles()

virtual void Gondwana.Hosting.GameHostBase.LoadAnimationCycles ( )
protectedvirtual

Loads animation cycle definitions.

Definition at line 251 of file GameHostBase.cs.

◆ LoadAssets()

virtual void Gondwana.Hosting.GameHostBase.LoadAssets ( )
protectedvirtual

Loads textures, sounds, and other game assets.

Definition at line 237 of file GameHostBase.cs.

◆ LoadContent()

void Gondwana.Hosting.GameHostBase.LoadContent ( )
protected

Loads assets, tilesheets, and animation cycles.

Definition at line 227 of file GameHostBase.cs.

◆ LoadTilesheets()

virtual void Gondwana.Hosting.GameHostBase.LoadTilesheets ( )
protectedvirtual

Loads tilesheet definitions.

Definition at line 244 of file GameHostBase.cs.

◆ OnDisposed()

virtual void Gondwana.Hosting.GameHostBase.OnDisposed ( )
protectedvirtual

Runs after managed resources have been disposed.

Reimplemented in Gondwana.Blazor.Hosting.BlazorGameHostBase.

Definition at line 480 of file GameHostBase.cs.

◆ OnDisposing()

virtual void Gondwana.Hosting.GameHostBase.OnDisposing ( )
protectedvirtual

Runs before managed resources are disposed.

Reimplemented in Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.

Definition at line 473 of file GameHostBase.cs.

◆ OnEngineInitialized()

virtual void Gondwana.Hosting.GameHostBase.OnEngineInitialized ( )
protectedvirtual

Runs after the engine has been initialized but before it has been started.

Definition at line 381 of file GameHostBase.cs.

◆ OnEngineStarted()

virtual void Gondwana.Hosting.GameHostBase.OnEngineStarted ( )
protectedvirtual

Runs after the engine has been started.

Definition at line 426 of file GameHostBase.cs.

◆ OnInitialized()

virtual void Gondwana.Hosting.GameHostBase.OnInitialized ( )
protectedvirtual

Runs after the full host initialization sequence has completed.

Definition at line 433 of file GameHostBase.cs.

◆ OnInitializing()

virtual void Gondwana.Hosting.GameHostBase.OnInitializing ( )
protectedvirtual

Runs before the host initialization sequence begins.

Definition at line 141 of file GameHostBase.cs.

◆ OnInputConfigured()

virtual void Gondwana.Hosting.GameHostBase.OnInputConfigured ( )
protectedvirtual

Runs after all input devices have been configured.

Platform hosts may override this hook to call InitializeWidgetInput(RenderSurfaceHostBase) once their render surface host is available.

Reimplemented in Gondwana.Avalonia.Hosting.AvaloniaBitmapGameHost, Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost, Gondwana.Blazor.Hosting.BlazorGameHostBase, Gondwana.WinForms.Hosting.WinFormsGameHost, and Gondwana.WinForms.Hosting.WinFormsGpuGameHost.

Definition at line 208 of file GameHostBase.cs.

◆ OnSceneBound()

virtual void Gondwana.Hosting.GameHostBase.OnSceneBound ( )
protectedvirtual

Runs after the current scene has been bound to the render surface host.

Reimplemented in Gondwana.WinForms.Hosting.WinFormsGameHostBase.

Definition at line 304 of file GameHostBase.cs.

◆ OnSceneGraphCreated()

virtual void Gondwana.Hosting.GameHostBase.OnSceneGraphCreated ( )
protectedvirtual

Runs after the scene graph has been created but before the scene is bound.

Definition at line 274 of file GameHostBase.cs.

◆ StartEngine()

void Gondwana.Hosting.GameHostBase.StartEngine ( )
protected

Starts the engine using the synchronization context returned by GetSynchronizationContext.

Exceptions
InvalidOperationExceptionThrown when no synchronization context is available.

Definition at line 392 of file GameHostBase.cs.

◆ StartEngineCore()

virtual void Gondwana.Hosting.GameHostBase.StartEngineCore ( SynchronizationContext syncContext)
protectedvirtual

Starts the engine using the supplied synchronization context.

Parameters
syncContextThe synchronization context used by the engine.

Reimplemented in Gondwana.Blazor.Hosting.BlazorGameHostBase.

Definition at line 408 of file GameHostBase.cs.

◆ StopEngine()

void Gondwana.Hosting.GameHostBase.StopEngine ( )
protected

Stops the engine during host disposal.

Definition at line 447 of file GameHostBase.cs.

◆ StopEngineCore()

virtual void Gondwana.Hosting.GameHostBase.StopEngineCore ( )
protectedvirtual

Performs platform-specific engine shutdown work.

Reimplemented in Gondwana.Blazor.Hosting.BlazorGameHostBase.

Definition at line 456 of file GameHostBase.cs.

◆ UnhookEvents()

virtual void Gondwana.Hosting.GameHostBase.UnhookEvents ( )
protectedvirtual

Unhooks custom event handlers during disposal.

Definition at line 440 of file GameHostBase.cs.

Property Documentation

◆ Engine

Engine Gondwana.Hosting.GameHostBase.Engine
get

Gets the singleton instance of the Gondwana engine.

Definition at line 25 of file GameHostBase.cs.

◆ Scene

Scene? Gondwana.Hosting.GameHostBase.Scene
getprotected set

Gets the current active scene.

Definition at line 30 of file GameHostBase.cs.

◆ WidgetInputRouter

WidgetInputRouter? Gondwana.Hosting.GameHostBase.WidgetInputRouter
getprotected

Gets the widget input router, if widget input has been initialized.

Definition at line 35 of file GameHostBase.cs.