RGFW: Single-header C99 window abstraction library

(github.com)

74 points | by klaussilveira 7 hours ago ago

15 comments

  • garbagepatch 41 minutes ago

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

  • felipefar 3 hours ago

    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.

    • colleagueRiley 3 hours ago

      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.

  • dmitrygr 3 hours ago

    > Wayland support is very experimental and broken

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

    • colleagueRiley 2 hours ago

      X11 needs a real alternative :(

    • amjoshuamichael 2 hours ago

      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.

      • colleagueRiley 2 hours ago

        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. :)

      • PittleyDunkin 38 minutes ago

        GLFW has worked well for me.

  • CyberDildonics 4 hours ago

    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.

    • colleagueRiley 3 hours ago

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

    • ranger_danger 3 hours ago

      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.

      • colleagueRiley 3 hours ago

        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.

        • ranger_danger 3 hours ago

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

          • colleagueRiley 2 hours ago

            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.

  • colleagueRiley 5 hours ago

    Thanks :)