Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
Vrmac
Vrmac Graphics, a cross-platform graphics library for .NET. Supports 3D, 2D, and accelerated video playback. Works on Windows 10 and Raspberry Pi4.
-
pixie
Pixie - a minimal, cross-platform pixel framebuffer library for Windows and macOS. (by samizzo)
-
minifb
MiniFB is a small cross platform library to create a frame buffer that you can draw pixels in
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
For any graphic intensive application it would be obviously be necessary to use a GPU.
But for quick hacking / porting old demos / writing emulators and also text based UI it can be fast enough.
With the added benefit of small footprint, high compatibility and fast startup time.
The Lite editor https://github.com/rxi/lite is using pure software rendering (on top of SDL) in a rather naïve fashion but it still renders full 32bit colors at full resolution at more than 60FPS on my computer, not the best solution but still surprisingly fast given the simplicity of the renderer.
This is typically a case where simple/naïve can beat a juggernaut like Electron.
Perfect companion for this C graphics library: https://github.com/tsoding/olive.c
I think this needs much more complexity to be useful.
For the rendering, ideally it needs GPU support.
Input needs much more work, here's an overview for Windows: https://zserge.com/posts/fenster/
Windows' Sleep() function has default resolution 15.6ms, that's not enough for realtime rendering, and relatively hard to fix, ideally need a modern OS and a waitable timer created with high resolution flag.
Here's my attempt at making something similar, couple years ago: https://github.com/Const-me/Vrmac
Very nice! I like that it's a single header. I wrote something similar although it's not single header, doesn't do audio, and no X11 backend https://github.com/samizzo/pixie. I use mine as a backend for Windows ports of MS-DOS demos that I make.
I think the Xlib dependency would prevent compilation as an αpε. I put some effort into doing X11 from scratch (without Xlib or Xcb) to make this possible. Or at least, my aim was to be able to build with musl libc and generate a single executable that would run on many different Linuxes.
https://github.com/abainbridge/deadfrog-lib/blob/master/src/.... It is janky though.
Not so minimal, but if you need GPU rendering I wrote this: https://github.com/jacereda/glcv
If anyone is interested in getting into zig, we made a library that has similar goals (and can run on WASM in the browser): https://github.com/ibebrett/zigzag
since everyone else is posting links to their similar libraries, i thought i'd post mine too, https://gitlab.com/kragen/bubbleos/-/tree/master/yeso
it's probably a bit more efficient than fenster on x-windows because it uses shared memory, and i think the programming interface is a little nicer (see the readme above for code examples)
apps i've written in yeso include an adm-3a terminal emulator, a tetris game, a raytracer, an rpn calculator, a fractal explorer, and so on
i haven't ported yeso to win32/64, macos, android, or the browser canvas yet, just x-windows, the linux framebuffer (partly), and a window system implemented in yeso called wercam
it includes bindings for c, python (via cffi), and lua (via luajit's ffi), and presumably you could use it from zig or rust in the same way as fenster, but i haven't tried
Related posts
- TIGR - the TIny GRaphics library for Windows, macOS, Linux, iOS and Android. (Released into Public Domain.)
- Minimal cross-platform graphics + audio (~500 LOC)
- TIGR – TIny GRaphics cross-platform library
- my little project: tipsy - tiny playstationy renderer in ~500 lines of code
- Question about window deletion/ recreation