Readit News logoReadit News
vmsp · 5 days ago
There's an accompanying blog post at https://zserge.com/posts/fenster/

This author has some pretty cool stuff, like a tiny alternative to Firebase https://zserge.com/posts/pennybase/

unwind · 4 days ago
There is at least two bugs in the blog post, here:

Next simple task would be to fill the complete framebuffer with a solid colour:

    memset(f->buf, rgb, f->width*f->height*sizeoof(uint32_t));
The first is the obvious typo around `sizeof`, which I didn't even see at first (edit: this).

The second is that code will only work for 8-bit colors, i.e. only the 8 (technically CHAR_BIT, "a byte") least-significant bits of `rgb` will be used. This is a quirk of the `memset()` standard C function, which has the prototype:

    void *memset(void s[.n], int c, size_t n);
but then the man page [1] says:

The memset() function fills the first n bytes of the memory area pointed to by s with the constant byte c.

[1]: https://man7.org/linux/man-pages/man3/memset.3.html

Deleted Comment

naruhodo · 4 days ago
It will fill the screen with any of 256 shades of grey, for which r == g == b.
darccio · 4 days ago
Neato! It's nice to find zserge around. He built upon the idea of my static site generator Zas [0] to create his own zs [1][2] a few years ago. I think he's still using it :)

[0]: https://github.com/darccio/zas

[1]: https://github.com/zserge/zs

[2]: https://zserge.com/posts/new-site-generator2/

int_19h · 5 days ago
That's not a GUI. It's something a GUI might be implemented in.
dragonwriter · 4 days ago
> That's not a GUI. It's something a GUI might be implemented in.

A GUI library is indeed not a GUI, but a library with which one might implement a GUI.

Usually, a GUI library does have things like actual controls implemented, but then most GUI libraries tend to present themselves as something closer to complete than most minimal.

It is unusual but not unreasonable to describe the combination of cross-platform canvas + keyboard/mouse events + audio playback as the “most-minimal GUI library”.

benterix · 4 days ago
> A GUI library is indeed not a GUI, but a library with which one might implement a GUI.

This definition basically blurs the distinction between a "GUI library" and "graphics library". A GUI library is GTK, QT and others. A graphics library is usually divided into 3D like *GL variants and 2D like SDL or Skia or thousands of others (including this one).

aa-jv · 4 days ago
Its a graphics primitive library, which can be used to implement a user interface.
vrighter · 4 days ago
Where's the GUI part? This seems like a more limited SDL. There is literally zero GUI code in there, unless you count manually drawing individual pixels a GUI. The shape drawing example (NOT part of the library) shows code using the library to draw basic shapes pixel-by-pixel. That is the very thing a GUI library is supposed to do for you.
naruhodo · 5 days ago
40 years ago, I cut my teeth on graphics programming in x86 assembly language and Turbo Pascal. Little graphical plots are just a really fun way to learn a language and programming concepts.

This is exactly what I want to practice some Zig programming.

CyberDildonics · 5 days ago
Could be cool, but if it is supposed to be a single header file it should say that instead of 'minimal'.

Also if it's just about getting a single window up with a pixel buffer it should say that.

Top priority should be getting screenshots on the github landing page.

phtrivier · 4 days ago
The problem is that the title says "cross-platform GUI", so some people would expect, you know, a GUI - windows, menus, text, buttons, sliders, scrollbars, input fields, etc...

This is more like a cross platform canvas on which you can draw.

Raylib was my goto for that, but an alternative can't hurt, I guess ?

CyberDildonics · 4 days ago
I don't think this is an alternative to raylib. The whole single header file is 13KB. It is basically a window, rgb buffer, and keyboard+mouse input.
rmonvfer · 5 days ago
Looks neat! I’m using C in a little side project and it would benefit from a simple GUI, let’s see what I can do with this. Also, just a recommendation but there isn’t even a single screenshot and I’d say that’s pretty important in a GUI library.
lstodd · 4 days ago
there are always tons of imgui-like libs.
armitron · 4 days ago
This can be more accurately described as a hack: there are subtle bugs (e.g. CLOCK_REALTIME is not monotonic) and corner cases that are not taken into account that I can't find any strong reasons to recommend this. One would be better served by something like SDL or raylib or if minimalism is a strict requirement, RGFW [1].

[1] https://github.com/ColleagueRiley/RGFW/blob/main/RGFW.h

kookamamie · 5 days ago
A windowing library, not a GUI library.
aa-jv · 4 days ago
A graphics primitive library, not a windowing library.