Gondwana.Blazor
2.5.2
dotnet add package Gondwana.Blazor --version 2.5.2
NuGet\Install-Package Gondwana.Blazor -Version 2.5.2
<PackageReference Include="Gondwana.Blazor" Version="2.5.2" />
<PackageVersion Include="Gondwana.Blazor" Version="2.5.2" />
<PackageReference Include="Gondwana.Blazor" />
paket add Gondwana.Blazor --version 2.5.2
#r "nuget: Gondwana.Blazor, 2.5.2"
#:package Gondwana.Blazor@2.5.2
#addin nuget:?package=Gondwana.Blazor&version=2.5.2
#tool nuget:?package=Gondwana.Blazor&version=2.5.2
Gondwana.Blazor
Gondwana.Blazor provides Blazor adapters for rendering and input, enabling Gondwana games to run as ASP.NET Blazor WebAssembly applications with standard cross-platform WASM support.
It mirrors the Gondwana.Avalonia package but targets the Blazor component model instead of
Avalonia UI.
Features
- Bitmap rendering surface using a browser
<canvas>element via the Canvas 2D API (no platform-specific SkiaSharp view package required) - Keyboard input integration via Blazor keyboard events on the canvas element
- Mouse / pointer input integration
- Touch input integration
BlazorKeyenum mapping browserKeyboardEvent.codevalues to integer key codes
Installation
dotnet add package Gondwana.Blazor
Usage
Add <BlazorBitmapRenderSurfaceComponent> to your Blazor page or layout and capture a reference
to it using @ref:
@using Gondwana.Blazor.Rendering
<BlazorBitmapRenderSurfaceComponent @ref="_surface" style="width: 800px; height: 600px;" />
Then initialize your game host in the component's OnAfterRenderAsync:
@code {
private BlazorBitmapRenderSurfaceComponent _surface = null!;
private MyGameHost? _host;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (!firstRender) return;
_host = new MyGameHost(_surface);
_host.Initialize();
}
}
Key codes
BlazorKeyboardAdapter uses (int)BlazorKey values as key codes. Use
BlazorKeyboardAdapter.GetKeyCodeFromString("ArrowLeft") to resolve a key name at runtime,
or use the BlazorKey enum directly:
Engine.Instance.Input.KeyboardEventPoller!.StartMonitoringKey(
(int)BlazorKey.Space, "Jump");
Touch input
Enable touch input by calling InitializeBlazorTouchAdapter:
Engine.Instance.InitializeBlazorTouchAdapter(renderSurface);
After initialization, the touch system is accessible via Engine.Instance.Input.TouchEventPoller.
Documentation
Related Packages
Gondwana--- Core engineGondwana.Audio.Browser--- Browser-based audio playback supportGondwana.Blazor.Hosting--- Blazor-specific game host that integrates rendering and input into the Gondwana lifecycleGondwana.Widgets--- UI widget library for creating in-game menus, HUDs, and overlays
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Gondwana (>= 2.5.2)
- Microsoft.AspNetCore.Components.Web (>= 8.0.29)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Gondwana.Blazor:
| Package | Downloads |
|---|---|
|
Gondwana.Blazor.Hosting
Blazor hosting implementation for the Gondwana Game Engine, providing a Blazor-specific game host for application startup, lifecycle management, and adapter integration in ASP.NET Blazor WebAssembly applications. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Full changelog: https://github.com/Isthimius/Gondwana/blob/master/CHANGELOG.md