MiniFB 0.7.0-alpha2

This is a prerelease version of MiniFB.
dotnet add package MiniFB --version 0.7.0-alpha2                
NuGet\Install-Package MiniFB -Version 0.7.0-alpha2                
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="MiniFB" Version="0.7.0-alpha2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MiniFB --version 0.7.0-alpha2                
#r "nuget: MiniFB, 0.7.0-alpha2"                
#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.
// Install MiniFB as a Cake Addin
#addin nuget:?package=MiniFB&version=0.7.0-alpha2&prerelease

// Install MiniFB as a Cake Tool
#tool nuget:?package=MiniFB&version=0.7.0-alpha2&prerelease                

MiniFB

MiniFB is a library for visualizing self-drawn frame buffers for .Net applications.

MiniFB is available on NuGet and GitHub Release!

The library itself provides managed wrappings around a custom version of the native original minifb library.


You can draw the contents of your frame buffer yourself - with every method C# (or other .Net languages) and the .Net ecosystem offer you. Then you can display your frame buffer in a window - in an easy and platform-independent way.

MiniFB also offers you a platform-independent way for most common scenarios when using desktop windows - like, for example, handling window events.


Requirements

  • .NET8 or above

  • currently Windows and Linux only, but you've got all relevant architectures there (x64, x86, arm64, arm)

    There's a plan to further expand the supported platforms in the future.

  • for additional usage dependencies per platform see USAGE.md

  • for building requirements see BUILD.md

Usage

See the quickstart guide.

Alternatively, you can see USAGE.md for a more in depth look on how to use MiniFB, or have a look at the sample applications.

Building

See BUILD.md.

Quickstart

Add a reference to your .NET8+ C#-project

In your .csproj file, add reference to the MiniFB package from NuGet:

<ItemGroup>
    <PackageReference Include="MiniFB" Version="0.7.0">
</ItemGroup>

Add a using directive to import from the MiniFB namespace

Add a using directive to the top a code file, where you want to reference parts of MiniFB:

using MiniFB;

Prepare your frame buffer

The frame buffer holds the data for each individual pixel for each frame:

var buffer = new Argb[800 * 600];

Create a window

You can create a new Window by simply calling it's constructor:

using var window = new Window("Hello World!", 800, 600);

Establish a main loop and redraw your frame buffer in each frame

In each frame, you'll most likely want to redraw the contents of your frame buffer:

do
{
    // your frame redraw logic goes here
}
while (...);

Update your window at the end of each frame

At the end of each frame, you want to update the window with the contents of your redrawn frame buffer and after that wait for frame synchronization.

Inside the tailing while statement from above, insert the following, so it looks like that:

while (
    // update the window with the contents of the frame buffer ...
    window.Update(buffer) is UpdateState.Ok

    // ... and then wait for frame synchronization
    && window.WaitForSync();
);
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.7.0-alpha2 55 9/19/2024
0.7.0-alpha1 62 9/9/2024