Doprez.Stride.Avalonia
1.1.19
dotnet add package Doprez.Stride.Avalonia --version 1.1.19
NuGet\Install-Package Doprez.Stride.Avalonia -Version 1.1.19
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Doprez.Stride.Avalonia" Version="1.1.19" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Doprez.Stride.Avalonia" Version="1.1.19" />
<PackageReference Include="Doprez.Stride.Avalonia" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Doprez.Stride.Avalonia --version 1.1.19
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Doprez.Stride.Avalonia, 1.1.19"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Doprez.Stride.Avalonia@1.1.19
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Doprez.Stride.Avalonia&version=1.1.19
#tool nuget:?package=Doprez.Stride.Avalonia&version=1.1.19
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Stride.Avalonia
Core bridge library that enables rendering Avalonia UI controls inside the Stride 3D game engine. This is the foundational package — all other packages in this repository depend on it.
How It Works
- Headless Avalonia —
AvaloniaApp.EnsureInitialized<T>()boots Avalonia's headless platform with Skia rendering (no native window). YourAvaloniaAppsubclass configures themes and styles. - Offscreen pages —
AvaloniaPagecreates a headlessWindow, manages frame capture with dirty-tracking, and provides the raw pixel data. Uses reflection to accessHeadlessWindowImpl._lastRenderedFramedirectly, avoiding LOH allocations fromCaptureRenderedFrame(). - Entity integration —
AvaloniaComponentis a StrideEntityComponentthat attaches an Avalonia page to an entity. Supports fullscreen overlays and world-space 3D panels. - Game system —
AvaloniaSystemruns every frame during the Update phase, collecting allAvaloniaComponentinstances, forwarding Stride input to Avalonia, and pumping the Avalonia dispatcher. - Rendering —
AvaloniaSceneRenderercaptures each component's Avalonia frame, uploads pixel data to GPU textures, and draws viaSpriteBatch(fullscreen) orSprite3DBatch(world-space).
Features
Rendering Modes
- Fullscreen overlays — auto-resize to the back buffer; drawn as screen-space sprites
- World-space 3D panels — configurable resolution, world size, billboarding, and AABB-based frustum culling
- Depth-sorted rendering — back-to-front ordering for correct alpha blending
Input Forwarding
- Mouse — move, button press/release, scroll wheel, with position deduplication during camera rotation
- Keyboard — key press/release with full modifier support (Shift, Ctrl, Alt)
- Text input —
TextInputevents forwarded for text field editing - 3D ray-casting — mouse interaction with world-space panels via ray-cast hit testing
- Smart input skipping — input forwarding is skipped when mouse buttons are held (e.g., during camera rotation)
Texture Atlas System
- Shelf-based texture packer — multiple world-space panels packed into shared atlas textures
- Auto-growth — starts at 1024x1024, grows up to 4096x4096 by doubling and GPU
CopyRegion - Batched draw calls — one draw call per atlas instead of one per panel
- Managed via
AvaloniaTextureAtlasManager— handles multiple atlases with O(1) reverse lookup
Performance
- Zero-allocation input bridge —
AvaloniaInputBridgeuses compiled expression delegates to callPlatformImpl.Inputdirectly, bypassingHeadlessWindowExtensionswhich runs jobs 20x per event - Direct framebuffer access — reflection-based shortcut avoids LOH allocations
- Dirty-update throttling —
MaxDirtyUpdatesPerFrameonAvaloniaSceneRendererlimits GPU texture uploads per frame
Profiling
AvaloniaRenderMetrics— singleton tracking per-phase timings (update, input, dispatcher, draw, capture, upload, sprite batch), panel counts, bytes uploaded, GC pressure, and rolling 120-frame historyAvaloniaProfilingKeys— integration with Stride's built-in profiler overlayDebugPanel— ready-to-use AvaloniaUserControldisplaying FPS, frame time, entity count, draw calls, triangles, memory, uptime, and detailed per-phase Avalonia metrics
Key Classes
| Class | Description |
|---|---|
AvaloniaApp |
Minimal Application subclass; call EnsureInitialized<T>() to boot headless Avalonia |
AvaloniaPage |
Abstract base for offscreen UI pages with dirty-tracking and frame capture |
DefaultAvaloniaPage |
Convenience wrapper that hosts any existing Avalonia Control |
AvaloniaComponent |
Stride EntityComponent — attach to an entity to display Avalonia UI |
AvaloniaSystem |
GameSystemBase — input forwarding and dispatcher pumping |
AvaloniaSceneRenderer |
SceneRendererBase — frame capture, GPU upload, and sprite drawing |
AvaloniaInputBridge |
Low-level input injection into headless Avalonia windows |
AvaloniaInputMapper |
Stride-to-Avalonia key/mouse/modifier mapping |
AvaloniaTextureAtlas |
Shelf-based GPU texture packer |
AvaloniaTextureAtlasManager |
Multi-atlas manager with reverse lookup |
AvaloniaRenderMetrics |
Performance metrics singleton |
DebugPanel |
Built-in debug overlay control |
Dependencies
| Package | Version |
|---|---|
| Avalonia | 11.3.* |
| Avalonia.Desktop | 11.3.* |
| Avalonia.Headless | 11.3.* |
| Stride.Engine | 4.4.0-beta2 |
Target Framework
net10.0 (cross-platform)
Usage
See the root README for setup instructions and code examples.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Avalonia (>= 11.3.18)
- Avalonia.Desktop (>= 11.3.18)
- Avalonia.Headless (>= 11.3.18)
- Stride.Engine (>= 4.4.0-beta2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.