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

Provides a base class for hosting Gondwana games in Avalonia applications using GPU-accelerated (OpenGL) rendering via AvaloniaGpuRenderSurfaceControl. More...

Inheritance diagram for Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost:
Gondwana.Hosting.GameHostBase

Protected Member Functions

 AvaloniaGpuGameHost (AvaloniaGpuRenderSurfaceControl renderSurface)
 Initializes a new instance of the AvaloniaGpuGameHost class.
override void ConfigurePlatform ()
 Configures Avalonia-specific platform features.
override void ConfigureKeyboard ()
 Configures the keyboard adapter for the Avalonia render surface.
override void ConfigureMouse ()
 Configures the mouse adapter for the Avalonia render surface.
override void ConfigureGamepads ()
 Configures gamepad support. Override to provide platform-specific gamepad integration.
override void ConfigureTouch ()
 Configures the touch adapter for the Avalonia GPU render surface.
override void BindScene ()
 Binds the current scene to the GPU render surface host.
override void OnDisposing ()
 Runs before managed resources are disposed.
virtual void OnConfigurePlatform ()
 Provides a hook for configuring platform-specific settings during initialization.
virtual void OnKeyboardAdapterInitialized ()
 Called after the keyboard adapter has been initialized. Override to perform additional keyboard setup.
virtual void OnMouseAdapterInitialized ()
 Called after the mouse adapter has been initialized. Override to perform additional mouse setup.
virtual void OnGamepadManagerInitialized ()
 Called after the gamepad manager has been initialized. Override to perform additional gamepad setup.
virtual void OnTouchAdapterInitialized ()
 Called after the touch adapter has been initialized. Override to perform additional touch setup, such as attaching gesture recognizers.
override void OnInputConfigured ()
 Called after input is configured during engine startup to initialize widget input for the render surface host.
Protected Member Functions inherited from Gondwana.Hosting.GameHostBase
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.
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 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 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

AvaloniaGpuRenderSurfaceControl RenderSurface [get]
 Gets the GPU render surface control used for displaying game content.
Properties inherited from Gondwana.Hosting.GameHostBase
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.

Additional Inherited Members

Public Member Functions inherited from Gondwana.Hosting.GameHostBase
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.

Detailed Description

Provides a base class for hosting Gondwana games in Avalonia applications using GPU-accelerated (OpenGL) rendering via AvaloniaGpuRenderSurfaceControl.

GPU rendering requires a desktop Avalonia target that supports OpenGL (Windows, macOS, or Linux). It is not suitable for WebAssembly (WASM) targets; use AvaloniaBitmapGameHost with AvaloniaBitmapRenderSurfaceControl for cross-platform / WASM scenarios.

Definition at line 16 of file AvaloniaGpuGameHost.cs.

Constructor & Destructor Documentation

◆ AvaloniaGpuGameHost()

Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.AvaloniaGpuGameHost ( AvaloniaGpuRenderSurfaceControl renderSurface)
protected

Initializes a new instance of the AvaloniaGpuGameHost class.

Parameters
renderSurfaceThe GPU render surface control to use for rendering.
Exceptions
ArgumentNullExceptionThrown when renderSurface is null.

Definition at line 28 of file AvaloniaGpuGameHost.cs.

Member Function Documentation

◆ BindScene()

override void Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.BindScene ( )
protectedvirtual

Binds the current scene to the GPU render surface host.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 79 of file AvaloniaGpuGameHost.cs.

◆ ConfigureGamepads()

override void Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.ConfigureGamepads ( )
protectedvirtual

Configures gamepad support. Override to provide platform-specific gamepad integration.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 62 of file AvaloniaGpuGameHost.cs.

◆ ConfigureKeyboard()

override void Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.ConfigureKeyboard ( )
protectedvirtual

Configures the keyboard adapter for the Avalonia render surface.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 44 of file AvaloniaGpuGameHost.cs.

◆ ConfigureMouse()

override void Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.ConfigureMouse ( )
protectedvirtual

Configures the mouse adapter for the Avalonia render surface.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 53 of file AvaloniaGpuGameHost.cs.

◆ ConfigurePlatform()

override void Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.ConfigurePlatform ( )
protected

Configures Avalonia-specific platform features.

Definition at line 36 of file AvaloniaGpuGameHost.cs.

◆ ConfigureTouch()

override void Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.ConfigureTouch ( )
protectedvirtual

Configures the touch adapter for the Avalonia GPU render surface.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 70 of file AvaloniaGpuGameHost.cs.

◆ OnConfigurePlatform()

virtual void Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.OnConfigurePlatform ( )
protectedvirtual

Provides a hook for configuring platform-specific settings during initialization.

Definition at line 94 of file AvaloniaGpuGameHost.cs.

◆ OnDisposing()

override void Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.OnDisposing ( )
protectedvirtual

Runs before managed resources are disposed.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 85 of file AvaloniaGpuGameHost.cs.

◆ OnGamepadManagerInitialized()

virtual void Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.OnGamepadManagerInitialized ( )
protectedvirtual

Called after the gamepad manager has been initialized. Override to perform additional gamepad setup.

Definition at line 109 of file AvaloniaGpuGameHost.cs.

◆ OnInputConfigured()

override void Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.OnInputConfigured ( )
sealedprotectedvirtual

Called after input is configured during engine startup to initialize widget input for the render surface host.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 120 of file AvaloniaGpuGameHost.cs.

◆ OnKeyboardAdapterInitialized()

virtual void Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.OnKeyboardAdapterInitialized ( )
protectedvirtual

Called after the keyboard adapter has been initialized. Override to perform additional keyboard setup.

Definition at line 99 of file AvaloniaGpuGameHost.cs.

◆ OnMouseAdapterInitialized()

virtual void Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.OnMouseAdapterInitialized ( )
protectedvirtual

Called after the mouse adapter has been initialized. Override to perform additional mouse setup.

Definition at line 104 of file AvaloniaGpuGameHost.cs.

◆ OnTouchAdapterInitialized()

virtual void Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.OnTouchAdapterInitialized ( )
protectedvirtual

Called after the touch adapter has been initialized. Override to perform additional touch setup, such as attaching gesture recognizers.

Definition at line 115 of file AvaloniaGpuGameHost.cs.

Property Documentation

◆ RenderSurface

AvaloniaGpuRenderSurfaceControl Gondwana.Avalonia.Hosting.AvaloniaGpuGameHost.RenderSurface
get

Gets the GPU render surface control used for displaying game content.

Definition at line 21 of file AvaloniaGpuGameHost.cs.