Hacker News Clone new | comments | show | ask | jobs | submit | github repologin
RGFW: Single-header C99 window abstraction library (github.com)
73 points by klaussilveira 7 hours ago | hide | past | web | 15 comments | favorite





This was added to raylib as a backend recently: https://github.com/raysan5/raylib/releases#:~:text=RGFW

You could support mobile platforms as well. IIRC, even if Android allows creating only one window per activity, this behavior can be easily mapped on the abstraction that you provide.

That's something I plan on looking into at some point. I'm unsure if I want that in the main version or a separate branch for embedded devices.

It's low priority though because my main focus is desktop applications.


I love single header libraries and I like the idea here of taking care of one necessity well. It seems like good modularity all around.

A quick heads up, the micro UI emscripten example doesn't work on chrome or firefox. The error is: DrawElements doesn't actually prepareClientAttributes properly.


I'm aware of the errors for the micro UI (on the web), it's something I plan on looking into soon!

The one big downside I see is that if you want to actually work on the library itself, it's a pain to have to re-compile the entire thing every time you change something.

Nuklear (https://github.com/Immediate-Mode-UI/Nuklear) uses separate files with a deploy script that combines them all into a single header; I think that approach is quicker for iterating on the code.


Sure, but the library is also relatively small, so it compiles quickly. Although if you want to you can compile it on its own.

It's also possible to compile it on its own using `gcc -c -x c -D RGFW_IMPLEMENTATION RGFW.h`

Nuklear is not a true single-header style library, it only uses that as a format. The difference is that the design is far less compact and lightweight than a stb-style library.

I'm pretty sure GLFW has some files that are nearly the same size as RGFW, for example.


Why do you claim Nuklear is not a "true single-header style library"? And who gets to say what that even means?

It is a single-header library in terms of the format, yes. But it is also not designed to be a single-header library, unlike an STB-style library.

Nuklear is a full-sized library that can be compiled into and used as one file. However, RGFW and STB are designed to be lightweight and minimalistic. That's the distinctive part of single-header libraries, also known as STB-style libraries.

To be clear, I don't mean this to hate on Nuklear, it's a cool UI library, but its design doesn't match the single-header format.


Thanks :)

> Wayland support is very experimental and broken

You and everyone else, RGFW, you and everyone else.


X11 needs a real alternative :(

Yeah, I've been looking for a minimal SDL alternative for a long time and I was really excited reading through this as that solution, but the lack of Wayland support is a huge dealbreaker for me.

Are there any good minimal windowing utilities that support Wayland? SDL does a lot I don't need and I try to maintain minimal dependencies. I suppose I could just use glfw & libsoundio, haven't tried that yet.


As far as I know, RGFW is the only minimal windowing of its kind. I guess I would suggest either targeting XWayland or using GLFW.

The Wayland API itself also really sucks to work with, even more so than Xlib....

But, RGFW's Wayland support will probably be improved in the future. :)


GLFW has worked well for me.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: