Giter Site home page Giter Site logo

mizrael / blazorex Goto Github PK

View Code? Open in Web Editor NEW
36.0 3.0 2.0 1.81 MB

Blazorex is an HTML Canvas wrapper library for Blazor.

Home Page: https://www.nuget.org/packages/Blazorex/

HTML 17.53% C# 59.27% CSS 12.75% JavaScript 10.45%
blazor blazor-webassembly canvas canvas2d game-development gamedev hacktoberfest

blazorex's Introduction

Blazorex

Nuget

Description

Blazorex is an HTML Canvas wrapper library for Blazor.

Blazorex

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>
    <!-- other tags... -->
    <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

blazorex's People

Contributors

mizrael avatar radim-nedved avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

blazorex's Issues

MouseCoords are always 0

Nice Package,

But MouseCoords seems to be 0 or default all the time.

It works if remove the readonly constrains,

public struct MouseCoords
{
    public int X { get; set; }
    public int Y { get; set; }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.