6 ms·
Fenster: Most minimal cross-platform GUI library
- thisislife2 1y agoI chuckled at, "And, yes, it can run Doom!"
- Forgret 1y agoHahaha, so it makes sense that DOOM can be run anywhere.
- ijidak 1y agoThis is exciting. This is great for data visualization and financial applications!
- rmonvfer 1y agoLooks 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 1y agothere are always tons of imgui-like libs.
- CyberDildonics 1y agoCould 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 1y agoThe 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 1y agoI 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.
- vmsp 1y agoThere's an accompanying blog post at https://zserge.com/posts/fenster/ https://zserge.com/posts/fenster/ This author has some pretty cool stuff, like a tiny alternative to Firebase https://zserge.com/posts/pennybase/ https://zserge.com/posts/pennybase/
- unwind 1y agoThere 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 https://man7.org/linux/man-pages/man3/memset.3.html
- deleted 1y ago[deleted]
- naruhodo 1y agoIt will fill the screen with any of 256 shades of grey, for which r == g == b.
- darccio 1y agoNeato! 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 https://github.com/darccio/zas [1]: https://github.com/zserge/zs https://github.com/zserge/zs [2]: https://zserge.com/posts/new-site-generator2/ https://zserge.com/posts/new-site-generator2/
- socalgal2 1y ago> API is designed to be a polling loop 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.
- IcyWindows 1y agoWhich one are you referring to?
- deleted 1y ago[deleted]
- deleted 1y ago[deleted]
- gt0 1y agoI'm assuming they mean the web.
- IcyWindows 1y agoOh! Of course
- CyberDildonics 1y agoThe most popular platform in the world does not allow using a polling loop 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.
- adastra22 1y agoI assume you mean the web? I’m not sure why that’d be relevant to a C library.
- int_19h 1y agoThat's not a GUI. It's something a GUI might be implemented in.
- dragonwriter 1y 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 1y 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).
- layer8 1y agoIt’s not just a graphics library because they provide cross-platform access to input events, timers, as well as audio playback.
- kookamamie 1y agoA windowing library, not a GUI library.
- aa-jv 1y agoA graphics primitive library, not a windowing library.
- naruhodo 1y ago40 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.
- lelanthran 1y ago> Fenster /ˈfɛnstɐ/ -- a German word for "window". Same in Afrikaans as well - "venster"[1] means window.
- porphyra 1y agoThat's not surprising as Afrikaans is highly related to Dutch which is in turn highly related to German. In this case it all comes from the Latin fenestra.
- kristianp 1y ago> Latin fenestra. Hence defenestrate, to throw out the window.
- brabel 1y agoFönster in Swedish.
- dvh 1y agoOkno in Slovak
- darccio 1y agoFinestra in Catalan, and Langas in Lithuanian.
- jraph 1y agoFenêtre in French. 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 https://en.wiktionary.org/wiki/window#Etymology (missing sources as of right now)
- memsom 1y agoAh - you are conflating Germanic for German. Germanic is not equivalent to German. German (deutsch) is a national language, Germanic is a language family. German belongs to this family, but it is not the root of all Germanic languages. English and German sit in the West Germanic branch, the East Germanic was mostly Gothic (dead) and the North Germanic languages are Swedish/Danish/Norwegian/Icelandic/Faroese and various other non national languages. English is a West Germanic language, but it was massively influenced by Old Norse (North Germanic) and various Frenches (and Latin/Greek in technical terms) as well as probably the native British languages somewhat in grammar (the present continuous tense in English also happens in Welsh, and is not very Germanic.) 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]. [1] https://en.wiktionary.org/wiki/vindu https://en.wiktionary.org/wiki/vindu [2] https://en.wiktionary.org/wiki/fenster https://en.wiktionary.org/wiki/fenster
- fitsumbelay 1y agono single facet of this that I don't love
- Surac 1y agonot connected to this, but i wish i would find a c code example on how to draw a line with a width, without antialias while only setting each pixel once. this seems to be a real hard problem.
- tubs 1y agoYou want to define a parallelogram or rectangle, turn it into edge equations, then iterate the spans. Alternative is bresenham then for each point iterate a span in the minor axis.
- deleted 1y ago[deleted]
- Avshalom 1y agohttp://homepages.enterprise.net/murphy/thickline/index.html http://homepages.enterprise.net/murphy/thickline/index.html pascal not C but you should be able to translate it pretty easy.
- armitron 1y agoThis 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 https://github.com/ColleagueRiley/RGFW/blob/main/RGFW.h
- vrighter 1y agoWhere'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.