Is there a Zig library for creating a framebuffer and window (sort of like minifb for Rust)?

I’m writing a small graphics library for a game I’m going to program in zig. I would like to know if there is any zig library that allows you to draw pixels directly to a frame buffer, sort of like the minifb or pixels library for Rust?

Alternatively, if there is a stable C library for this I’m open to using this too - although I still haven’t fully wrapped my head around zig’s crazy build system so might need some help setting it up!

Thanks!

Check out Seizer: Wayland application framework

Look to be basically Linux only, but guessing that’s ok for the OP;-)

Thank you, I’ll check it out!

Yes, for me wayland / linux is fine, although I may port to another library later for windows/macos support if I find a library that can do that (or write my own). This looks great for now!

(shameless plug): Not “window + framebuffer”, but “window + 3d API”: GitHub - floooh/sokol-zig: Zig bindings for the sokol headers (https://github.com/floooh/sokol) (it’s not Zig all the way down, but Zig bindings to underlying C libraries, but the bindings feel quite ‘ziggy’)

For a pixel framebuffer you would copy the pixels from a CPU memory region into a texture and render that texture via the 3D API (I’m actually pondering wrapping exactly this functionality in a new sokol library, but don’t hold your breath)

4 Likes

Your library looks great! I think for now, I’m going to use the C library of minifb as it has worked quite well for me in the past. When I upgrade my library though, I’ll definitely consider using sokol!