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.
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 ?
This author has some pretty cool stuff, like a tiny alternative to Firebase https://zserge.com/posts/pennybase/
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.
[0]: https://github.com/darccio/zas
IMO this is a mistake. The most popular platform in the world does not allow using a polling loop. You can hack things to simulate it but eventually you'll run into where this will break for you. Better to start with something more forward compatible.
I don't know what that means, but just because something else doesn't use a polling loop doesn't mean it's a mistake or the wrong fit.
Something like this so simple there is likely to be a lot that gets done inside the main loop, not the least of which is drawing into the buffer which is most of the point.
If we also believe that the desktop GUI apps are a thing of the past, and in the future everyone wants only web apps, we'd want to pick a C library for the UI which allows building for the web, for the future scenario where we have to port the app to stay relevant.
The scenario might not materialize, but having a contingency plan sure feels nice.
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”.
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).
OpenGL (what I assume you are referring to by *GL) is both 2D and 3D; it also, as one might expect of purely a graphics library, doesn't provide control events or audio and considers that something else's problem.
SDL ("Simple DirectMedia Layer") does do things like control events and audio, but does not describe itself as a graphics library, but as "a cross-platform library designed to make it easy to write multi-media software, such as games and emulators."
This is exactly what I want to practice some Zig programming.
Same in Afrikaans as well - "venster"[1] means window.
Hence defenestrate, to throw out the window.
Funny, English words often come from either German or French. Here where German and French agree, English is different.
https://en.wiktionary.org/wiki/window#Etymology (missing sources as of right now)
So - Window is Germanic. It comes from Old Norse 'vindauga', and the modern Norwegian Bokmal version is 'vindu'[1].
The German word for Window comes from Latin [2].
Alternative is bresenham then for each point iterate a span in the minor axis.
pascal not C but you should be able to translate it pretty easy.
thisislife2•1d ago
Forgret•1d ago