Blazorex 1.0.4
dotnet add package Blazorex --version 1.0.4
NuGet\Install-Package Blazorex -Version 1.0.4
<PackageReference Include="Blazorex" Version="1.0.4" />
paket add Blazorex --version 1.0.4
#r "nuget: Blazorex, 1.0.4"
// Install Blazorex as a Cake Addin #addin nuget:?package=Blazorex&version=1.0.4 // Install Blazorex as a Cake Tool #tool nuget:?package=Blazorex&version=1.0.4
Blazorex
Description
Blazorex is an HTML Canvas wrapper library for Blazor.
It has some interesting functionalities like:
- multiple canvases
- background rendering
- image rendering
- procedural image generation (yes, the fire on the background is fully procedural! Thanks filipedeschamps for the awesome repository showing how to render the Doom fire! )
Installation
Blazorex can be installed as Nuget package: https://www.nuget.org/packages/Blazorex/
Usage
Simply add the Canvas
Component to your Razor page and register to the OnCanvasReady
to receive the CanvasBase
instance.
Then use OnFrameReady
to define your update/render logic:
<Canvas Width="800" Height="600"
OnFrameReady="(t) => OnFrameReady(t)"
OnCanvasReady="(ctx) => OnCanvasReady(ctx)" />
@code{
CanvasBase _canvas;
private void OnCanvasReady(CanvasBase canvas)
{
_canvas = canvas;
}
private void OnFrameReady(float timeStamp)
{
// your render logic goes here
}
}
You might also need to update your index.html
to include the library's CSS:
<head>
<link href="_content/Blazorex/blazorex.css" rel="stylesheet" />
</head>
For a complete sample, check the ./src/Blazorex.Web folder.
A sample game can be found here: Blazeroids
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. |
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.