I've recently started working on a raycaster, and I needed a way to draw direct pixel graphics to the screen. Given I've used and enjoyed using SFML before, it was the natural choice for me. I'm using the .net binding in C# via the nuget package. This isn't anything special compared to some of the awesome games and apps people have made on here, but in the off chance anyone wants to do some direct pixel work, feel free to fork my repo and use it however you like.
https://github.com/Jallenbah/pixelwindowWhat it is: A simple framework for drawing realtime direct per-pixel graphics in C# for applications such as raycasters, raytracers, and retro games. This uses the .Net binding of SFML for rendering, which allows for easy use of its additional functionality such as image loading, audio, and input.
This framework allows you to render at magnified pixel sizes, for example, the following example program will create a window of size 1024x576, with pixels 8x screen pixel size, resulting in a 128x72 drawing area.
new PixelWindow
(1024,
576,
8,
"Big pixels",
... When you create the window, you give an instance of a class overriding a simple interface (
IPixelWindowAppManager.cs) with functions for the following -
- An onload function which gives you the SFML window so you can use it for input etc.
- An update function which runs every frame
- An update function which runs once per fixed timestep increment
- A render function which runs every frame and gives you access to set direct pixel data
A basic setup can be seen in
Program.cs, which renders randomly coloured pixels at as high a framerate as it can up to the specified framerate limit. As seen in the window title (showing a total render time of 0.5ms), this is able to render at a couple of thousand frames per second, so the performance of the framework shouldn't hold back the performance of your rendering code on modern hardware.
Cheers