All Projects → aesalazar → AsteroidsWasm

aesalazar / AsteroidsWasm

Licence: other
Collection of applications based on a single C# .NET Standard project running in: Blazor Client (WebAssembly), Blazor Server, Electron, WPF, WinForms, Xamarin

Programming Languages

C#
18002 projects
HTML
75241 projects
CSS
56736 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to AsteroidsWasm

TheLastTime
C# .NET 5 Blazor WebAssembly Progressive Web Application that tracks when was the last time you did something
Stars: ✭ 23 (-83.09%)
Mutual labels:  wpf, winforms, blazor, blazor-webassembly
Blazorade-Teams
A Blazor component library that is designed to be used when building applications for Microsoft Teams.
Stars: ✭ 29 (-78.68%)
Mutual labels:  blazor, blazor-client, blazor-server, blazor-webassembly
MudBlazor
Blazor Component Library based on Material design with an emphasis on ease of use. Mainly written in C# with Javascript kept to a bare minimum it empowers .NET developers to easily debug it if needed.
Stars: ✭ 4,539 (+3237.5%)
Mutual labels:  blazor, blazor-client, blazor-server, blazor-webassembly
AutoSaveEditForm
A replacement for the default EditForm component which will auto save a form until it is successfully submitted
Stars: ✭ 44 (-67.65%)
Mutual labels:  blazor, blazor-client, blazor-server, blazor-webassembly
smart-blazor
Blazor UI Components & Examples
Stars: ✭ 32 (-76.47%)
Mutual labels:  blazor, blazor-client, blazor-server, blazor-webassembly
MudBlazor.Markdown
Markdown component based on the MudBlazor environment
Stars: ✭ 30 (-77.94%)
Mutual labels:  blazor, blazor-client, blazor-server, blazor-webassembly
blazor-docs
Public Documentation for Telerik UI for Blazor components.
Stars: ✭ 42 (-69.12%)
Mutual labels:  blazor, blazor-client, blazor-server
DebounceMonitoring
📑 Add debounce logic for any method in a single line.
Stars: ✭ 44 (-67.65%)
Mutual labels:  uwp, wpf, winforms
Csla
A home for your business logic in any .NET application.
Stars: ✭ 865 (+536.03%)
Mutual labels:  uwp, wpf, winforms
Reactivemvvm
Cross-platform ReactiveUI sample app built for a talk at MSK .NET conf.
Stars: ✭ 94 (-30.88%)
Mutual labels:  uwp, wpf, winforms
Matblazor
Material Design components for Blazor and Razor Components
Stars: ✭ 2,599 (+1811.03%)
Mutual labels:  blazor, blazor-client, blazor-server
Microsoft.Toolkit.Win32
This repository contains all controls for WPF and WinForms to simplify and demonstrate usage of UWP controls
Stars: ✭ 345 (+153.68%)
Mutual labels:  uwp, wpf, winforms
Reactiveui
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms that is inspired by functional reactive programming. ReactiveUI allows you to abstract mutable state away from your user interfaces, express the idea around a feature in one readable place and improve the testability of your application.
Stars: ✭ 6,709 (+4833.09%)
Mutual labels:  uwp, wpf, winforms
Try Convert
Helping .NET developers port their projects to .NET Core!
Stars: ✭ 671 (+393.38%)
Mutual labels:  dotnetcore, wpf, winforms
MASA.Blazor
Blazor component library based on Material Design. Support Blazor Server and Blazor WebAssembly.
Stars: ✭ 469 (+244.85%)
Mutual labels:  dotnetcore, blazor, blazor-server
XamlIslands
Repository with several XAML Islands v1 samples (Win32, WPF, and WinForms) to demonstrate how to use it.
Stars: ✭ 47 (-65.44%)
Mutual labels:  uwp, wpf, winforms
EBind
🔵 .NET Data Binding we deserve: concise, fast, feature-rich
Stars: ✭ 141 (+3.68%)
Mutual labels:  uwp, wpf, winforms
Microsoft.toolkit.win32
This repository contains all controls for WPF and WinForms to simplify and demonstrate usage of UWP controls
Stars: ✭ 257 (+88.97%)
Mutual labels:  uwp, wpf, winforms
SciColorMaps
Custom .NET color maps (user-defined or imported from matplotlib) for scientific visualization
Stars: ✭ 26 (-80.88%)
Mutual labels:  uwp, wpf, winforms
Corehook
A library that simplifies intercepting application function calls using managed code and the .NET Core runtime
Stars: ✭ 191 (+40.44%)
Mutual labels:  uwp, dotnetcore, dotnet-standard

Asteroids in .NET Framework, .NET 7, and Blazor WebAssembly

Live Demo: https://aesalazar.github.io/AsteroidsWasm/

This project is a POC to determine the plausibility of writing a .NET Standard library and using it across devices INCLUDING WebAssembly (WASM). The root library, Asteroids.Standard, encapsulates all logic for rendering the classic '80s video game. None of this is meant to be production-worthy. It is more me just messing around trying to see what works.

The original code was adopted from a very cool WinForms project on CodePlex by Howard Uman, circa 2004:

https://www.codeproject.com/articles/7428/c-asteroids

Which now resides here:

https://github.com/unhuman/csharp-asteroids

It was chosen because it was already in C# and very straight forward in terms of inheritance and logic. Separating the logic from the UI layer was relatively simple.

Currently, the project is made of the following:

  • Asteroids.Standard - .Net Standard Library containing the game engine.

  • Asteroids.WinForms - Reconstructed WinForms GUI that uses the game engine with a PictureBox as the main renderer. This is targets .NET 7 by default but can also be set for .NET Framework 4.8.

  • Asteroids.Wpf - Equivalent WPF GUI to the WinForms applications that uses a WPF WriteableBitmap as the main renderer with help from the WritableBitmapEx library. This is targets .NET 7 by default but can also be set for .NET Framework 4.8.

  • Asteroids.Xamarin - The core Xamarin application that uses SkiaSharp for 2D rendering via a SKCanvasView.

  • Asteroids.Xamarin.Android - Android GUI that uses the core Xamarin library.

  • Asteroid.Xamarin.UWP - UWP GUI that uses the core Xamarin library.

  • Asteroids.Blazor.Wasm - WebAssembly project that uses Microsoft's Blazor Client to allow cross-compiling the C# code to WASM so it can be rendered in a browser (see below for more info).

  • Asteroids.Blazor.Server - Similar to the Wasm project but instead uses Microsoft's Blazor Server to execute the application server-side (see below for more info).

  • Asteroids.Blazor.Electron - Similar to the above Blazor Server project but running inside Electron to execute the code as a Desktop application.

  • Asteroids.Blazor.Maui - Similar to the Blazor WASM project but instead uses Blazor Hybrid MAUI to host the same game engine as a desktop or mobile app (see below for more info).

  • Asteroids.BlazorComponents - Blazor Class Library that contains the actual game engine instantiated object and associated HTML and JavaScript bridge to allow rendering in the browser.

General Notes

All applications are written in Visual Studio and can be launch simply by doing Debug -> Start New Instance. All are fully functional in terms of sound and keyboard support.

Note that the Blazor, WinForms .NET 7 and Wpf .NET 7 projects require Visual Studio 2022 or the latest Visual Studio Code to edit and compile; otherwise it can be done via Command Line.

Performance varies among the technologies with WinForms in .NET 7 being the clear winner for desktop and Firefox for Blazor/Web. Wpf in .NET 7 is a close second for desktop, however, the UWP app is also quite fast and has better sound support in that more then one can play at a time, out of the box. The new MAUI app is also quite fast and maybe even the fastest but would require a more scientific analysis to really make the call.

.NET 7 Notes

All .NET 7 applications including Blazor are tested on version 7.0.102 of the SDK so remember to have it installed. You can check what versions are installed (you can have multiple) by entering in a command prompt:

dotnet --info or dotnet --version

To run all projects in this solution requires the installation of Visual Studio 2022 minimum or the latest Visual Studio Code.

Xamarin Notes

The Android application will need some additional configuration like any other Xamarin project, e.g. I test in an Android 13.0 VM running on my dev machine.

There is no Xamarin iOS app at this point only because Apple does not allow development on non-macs (which is what I am on) without connected hardware. But there is no technical reason for it not to be possible.

The UWP application is set to require the Windows 10 Fall Creators Update at a minimum. This is necessary to run the latest .NET 7 and Standard versions.

Blazor Notes

Microsoft has made Blazor officially part of .NET Core. It was first included in 3.0 Preview 4. Prior to that it was a separate library/install.

The difference between the Wasm and Server projects is the hosting model. With Blazor, you have the option to either fully host the code and application Client-Side via WebAssembly or Server-Side with updates pushed to the Client via SignalR. In a production application, the choice would be highly dependent on the situation and more information can be found on Microsoft's Hosting Models Page.

To build the app, simply do it from Visual Studio - just make sure you have all dependencies listed on their Getting Stated page at Blazor.

Building from CLI in the Asteroids.Blazor.Wasm project folder is also an option:

dotnet build -c Release

To run the application, simply hit F5 or ctrl+F5 in Visual Studio or from the CLI:

dotnet run

The app can be published with:

dotnet publish -c Release

Blazor Electron Notes

The Blazor Electron project is probably the most experimental of all in this repo. It uses the Electron.NET wrapper in conjunction with a Blazor Server app to show a the game in a Desktop application.

It requires the global installation of the ElectronNet.CLI before it can be ran:

dotnet tool install ElectronNET.CLI -g

Once done, it can be ran like any other project from within Visual Studio.

NOTE: Electron.NET requires node.js and npm so make sure to have them installed. If you do not just grab the latest LTS:

https://nodejs.org/en/

NOTE 2: Sometimes I get an "is being used by another process" error when attempting to start from Visual Studio. I have not been able to narrow it down but it seems to be a known issue with the package. You can easily tell by trying to delete the obj or bin folders and getting file lock errors. If it happens, look in Task Manager for any running instances of electron.exe. Kill them and it should resolve.

Blazor MAUI Notes

This is the most recent addition to the collection. It was created using the Visual Studio Wizard for a Blazor MAUI project. The Weather demo components were removed along with a general cleanup. Then a reference to the Astorids.BlazorComponents project was made and added to the main layout. It is very similar to how the Asterdoids.Blazor.Wasm project works.

I left all of the Platform resources as is (Windows, Android, iOS, etc.). I have only tested Windows and Android, both of which started up flawlessly. Android used the same simiulator I had created for the Asteroids.Xamarin.Andoird project. I didnt have an Apple developer subscription available but I image it will work with little effort.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].