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

Provides the shared Gondwana lifecycle integration for Blazor bitmap and WebGL game hosts. More...

Inheritance diagram for Gondwana.Blazor.Hosting.BlazorGameHostBase:
Gondwana.Hosting.GameHostBase Gondwana.Blazor.Hosting.BlazorGameHost Gondwana.Blazor.Hosting.BlazorGpuGameHost

Public Member Functions

void ConfigureLogicalResolution (int logicalWidth, int logicalHeight)
 Establishes a minimum logical game size from the first usable Blazor canvas dimensions.
void OnAnimationFrame ()
 Advances the timer-driven bitmap path from Gondwana's browser animation loop.
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.

Protected Member Functions

 BlazorGameHostBase (IJSRuntime jsRuntime)
 Initializes a new instance of BlazorGameHostBase.
void BindSceneCore (Scene scene)
 Binds a scene to the concrete typed render-surface host.
override void ConfigurePlatform ()
override void ConfigureKeyboard ()
 Configures the keyboard input adapter.
override void ConfigureMouse ()
 Configures the mouse input adapter.
override void ConfigureGamepads ()
 Configures the gamepad manager.
override void ConfigureTouch ()
 Configures the touch input adapter.
override void BindScene ()
 Binds the current scene to the platform render surface.
override? SynchronizationContext GetSynchronizationContext ()
 Gets the synchronization context used to start the engine.
Returns
The synchronization context, or null when unavailable.

override void StartEngineCore (SynchronizationContext syncContext)
 Starts the engine using the supplied synchronization context.
Parameters
syncContextThe synchronization context used by the engine.

override void StopEngineCore ()
 Performs platform-specific engine shutdown work.
override void OnInputConfigured ()
 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.
override void OnDisposed ()
 Runs after managed resources have been disposed.
virtual void OnConfigurePlatform ()
 Provides a hook for configuring additional Blazor platform settings.
virtual void OnKeyboardAdapterInitialized ()
 Called after the Blazor keyboard adapter is initialized.
virtual void OnMouseAdapterInitialized ()
 Called after the Blazor mouse adapter is initialized.
virtual void OnConfigureGamepads ()
 Provides a hook for configuring browser gamepad support.
virtual void OnTouchAdapterInitialized ()
 Called after the Blazor touch adapter is initialized.
virtual void OnBlazorDisposed ()
 Runs after Blazor interop resources have been released.
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 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.
void DisposeEngine ()
 Disposes the engine instance.
virtual void OnDisposing ()
 Runs before managed resources are disposed.
void EnsureNotInitialized ()
 Ensures that the host has not already been initialized.
void EnsureNotDisposed ()
 Ensures that the host has not been disposed.

Properties

BlazorRenderSurfaceComponentBase RenderSurfaceComponent [get]
 Gets the concrete Blazor component that supplies DOM input events.
RenderSurfaceHostBase RenderSurfaceHost [get]
 Gets the render-surface host used for scene binding and widget input.
virtual bool RenderSurfaceDrivesBrowserFrames [get]
 Gets a value indicating whether the render surface itself supplies the browser animation callback that drives the timer-driven engine.
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.

Detailed Description

Provides the shared Gondwana lifecycle integration for Blazor bitmap and WebGL game hosts.

Browser/WASM targets use timer-driven engine execution. Bitmap hosts are driven by Gondwana's JavaScript requestAnimationFrame loop, while WebGL hosts are driven directly by the SKGLView animation loop so engine advancement and GPU presentation share one browser animation-frame callback. Non-browser targets retain the standard background engine loop supplied by GameHostBase.

Definition at line 20 of file BlazorGameHostBase.cs.

Constructor & Destructor Documentation

◆ BlazorGameHostBase()

Gondwana.Blazor.Hosting.BlazorGameHostBase.BlazorGameHostBase ( IJSRuntime jsRuntime)
protected

Initializes a new instance of BlazorGameHostBase.

Parameters
jsRuntimeThe JavaScript runtime used for browser interop.
Exceptions
ArgumentNullExceptionThrown when jsRuntime is null.

Definition at line 63 of file BlazorGameHostBase.cs.

Member Function Documentation

◆ BindScene()

override void Gondwana.Blazor.Hosting.BlazorGameHostBase.BindScene ( )
sealedprotectedvirtual

Binds the current scene to the platform render surface.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 127 of file BlazorGameHostBase.cs.

◆ BindSceneCore()

void Gondwana.Blazor.Hosting.BlazorGameHostBase.BindSceneCore ( Scene scene)
abstractprotected

Binds a scene to the concrete typed render-surface host.

Parameters
sceneThe scene to bind.

◆ ConfigureGamepads()

override void Gondwana.Blazor.Hosting.BlazorGameHostBase.ConfigureGamepads ( )
sealedprotectedvirtual

Configures the gamepad manager.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 114 of file BlazorGameHostBase.cs.

◆ ConfigureKeyboard()

override void Gondwana.Blazor.Hosting.BlazorGameHostBase.ConfigureKeyboard ( )
sealedprotectedvirtual

Configures the keyboard input adapter.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 100 of file BlazorGameHostBase.cs.

◆ ConfigureLogicalResolution()

void Gondwana.Blazor.Hosting.BlazorGameHostBase.ConfigureLogicalResolution ( int logicalWidth,
int logicalHeight )

Establishes a minimum logical game size from the first usable Blazor canvas dimensions.

Parameters
logicalWidthThe requested logical width in pixels.
logicalHeightThe requested logical height in pixels.

Call after the engine is initialized. The first real canvas size (not the initial 1x1 placeholder) establishes RenderScale once. Later browser resizes use the existing presentation/input transform, without resizing the backbuffer. Browser layout and aspect fitting remain the application's CSS responsibility. Omit this call to keep the engine's normal render-scale behavior.

Exceptions
ArgumentOutOfRangeExceptionA logical size is not positive.
InvalidOperationExceptionThrown when the engine is not initialized or logical resolution was already configured.

Definition at line 43 of file BlazorGameHostBase.cs.

◆ ConfigureMouse()

override void Gondwana.Blazor.Hosting.BlazorGameHostBase.ConfigureMouse ( )
sealedprotectedvirtual

Configures the mouse input adapter.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 107 of file BlazorGameHostBase.cs.

◆ ConfigurePlatform()

override void Gondwana.Blazor.Hosting.BlazorGameHostBase.ConfigurePlatform ( )
sealedprotected

Definition at line 91 of file BlazorGameHostBase.cs.

◆ ConfigureTouch()

override void Gondwana.Blazor.Hosting.BlazorGameHostBase.ConfigureTouch ( )
sealedprotectedvirtual

Configures the touch input adapter.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 120 of file BlazorGameHostBase.cs.

◆ GetSynchronizationContext()

override? SynchronizationContext Gondwana.Blazor.Hosting.BlazorGameHostBase.GetSynchronizationContext ( )
sealedprotectedvirtual

Gets the synchronization context used to start the engine.

Returns
The synchronization context, or null when unavailable.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 137 of file BlazorGameHostBase.cs.

◆ OnAnimationFrame()

void Gondwana.Blazor.Hosting.BlazorGameHostBase.OnAnimationFrame ( )

Advances the timer-driven bitmap path from Gondwana's browser animation loop.

Definition at line 183 of file BlazorGameHostBase.cs.

◆ OnBlazorDisposed()

virtual void Gondwana.Blazor.Hosting.BlazorGameHostBase.OnBlazorDisposed ( )
protectedvirtual

Runs after Blazor interop resources have been released.

Definition at line 249 of file BlazorGameHostBase.cs.

◆ OnConfigureGamepads()

virtual void Gondwana.Blazor.Hosting.BlazorGameHostBase.OnConfigureGamepads ( )
protectedvirtual

Provides a hook for configuring browser gamepad support.

Definition at line 239 of file BlazorGameHostBase.cs.

◆ OnConfigurePlatform()

virtual void Gondwana.Blazor.Hosting.BlazorGameHostBase.OnConfigurePlatform ( )
protectedvirtual

Provides a hook for configuring additional Blazor platform settings.

Definition at line 224 of file BlazorGameHostBase.cs.

◆ OnDisposed()

override void Gondwana.Blazor.Hosting.BlazorGameHostBase.OnDisposed ( )
sealedprotectedvirtual

Runs after managed resources have been disposed.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 206 of file BlazorGameHostBase.cs.

◆ OnInputConfigured()

override void Gondwana.Blazor.Hosting.BlazorGameHostBase.OnInputConfigured ( )
sealedprotectedvirtual

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 from Gondwana.Hosting.GameHostBase.

Definition at line 199 of file BlazorGameHostBase.cs.

◆ OnKeyboardAdapterInitialized()

virtual void Gondwana.Blazor.Hosting.BlazorGameHostBase.OnKeyboardAdapterInitialized ( )
protectedvirtual

Called after the Blazor keyboard adapter is initialized.

Definition at line 229 of file BlazorGameHostBase.cs.

◆ OnMouseAdapterInitialized()

virtual void Gondwana.Blazor.Hosting.BlazorGameHostBase.OnMouseAdapterInitialized ( )
protectedvirtual

Called after the Blazor mouse adapter is initialized.

Definition at line 234 of file BlazorGameHostBase.cs.

◆ OnTouchAdapterInitialized()

virtual void Gondwana.Blazor.Hosting.BlazorGameHostBase.OnTouchAdapterInitialized ( )
protectedvirtual

Called after the Blazor touch adapter is initialized.

Definition at line 244 of file BlazorGameHostBase.cs.

◆ StartEngineCore()

override void Gondwana.Blazor.Hosting.BlazorGameHostBase.StartEngineCore ( SynchronizationContext syncContext)
sealedprotectedvirtual

Starts the engine using the supplied synchronization context.

Parameters
syncContextThe synchronization context used by the engine.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 154 of file BlazorGameHostBase.cs.

◆ StopEngineCore()

override void Gondwana.Blazor.Hosting.BlazorGameHostBase.StopEngineCore ( )
sealedprotectedvirtual

Performs platform-specific engine shutdown work.

Reimplemented from Gondwana.Hosting.GameHostBase.

Definition at line 190 of file BlazorGameHostBase.cs.

Property Documentation

◆ RenderSurfaceComponent

BlazorRenderSurfaceComponentBase Gondwana.Blazor.Hosting.BlazorGameHostBase.RenderSurfaceComponent
getabstractprotected

Gets the concrete Blazor component that supplies DOM input events.

Definition at line 69 of file BlazorGameHostBase.cs.

◆ RenderSurfaceDrivesBrowserFrames

virtual bool Gondwana.Blazor.Hosting.BlazorGameHostBase.RenderSurfaceDrivesBrowserFrames
getprotected

Gets a value indicating whether the render surface itself supplies the browser animation callback that drives the timer-driven engine.

The bitmap path returns false and uses Gondwana's JavaScript animation loop. The WebGL path returns true because SKGLView owns the browser requestAnimationFrame loop and calls Gondwana.Engine.Tick from its paint callback.

Definition at line 84 of file BlazorGameHostBase.cs.

◆ RenderSurfaceHost

RenderSurfaceHostBase Gondwana.Blazor.Hosting.BlazorGameHostBase.RenderSurfaceHost
getabstractprotected

Gets the render-surface host used for scene binding and widget input.

Definition at line 72 of file BlazorGameHostBase.cs.