Skip to content

migaweb/BlazorCanvas

 
 

Repository files navigation

BlazorCanvas

I started this project with the intention of learning/exploring what can be done with Blazor and 2d graphics. I am an old-time videogames lover and I always enjoyed coding small games and prototypes in my spare time.

The goal is to create small examples, built one on top of the other, showing how easy it is to render 2d elements using Blazor. Eventually I might end up writing a full game, it highly depends on how much time I'll have.

The repository is divided into numbered subfolders, each one with a single example.

Every example is also published on GitHub Pages via GitHub Actions using the approach outlined here . The master branch is used to host the published pages. The main branch is development.

Examples

  • Example1 shows how to initialize the 2d canvas
  • Example2 shows how to render a sprite and react to the window resize event
  • Example3 shows how to move a sprite on the screen
  • Example4 builds on top of the previous one, refactoring and cleaning up the code
  • Example5 shows how to handle mouse inputs
  • Example6 shows how to animate a sprite. Spritesheets were downloaded from here and combined using a custom tool
  • Example7 shows how to control animations using the keyboard
  • Example8 shows how to use a FSM to control animations and move the character on the screen
  • Example9 refactors the code and introduces the Scene Graph
  • Example10 adds the Assets Resolver
  • Example11 shows how to do collision detection

Tutorials

Every example will be explained in detail by an article on my personal blog:

About

Simple 2D gamedev examples using Blazor and .NET 5

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 63.1%
  • HTML 34.6%
  • CSS 1.2%
  • Other 1.1%