HNHacker News
TopNewBestAskShowJobs

colleagueRiley

40 karma · joined September 16, 2023

submissionscomments
colleagueRiley··on Is it possible to write plain C iOS app in 2025?
I made RGFW, which calls Objective-C MacOS's API functions in Pure C.

BUT I would also like to mention a project a friend and I made called Silicon. Silicon is a single-header C wrapper around the Pure-C calls, which makes it far more convenient to use.

https://github.com/eimamei/silicon

I no longer use it in RGFW because I wanted to remove the extra dependency.

colleagueRiley··on RGFW: Single-header C99 window abstraction library
No lol
colleagueRiley··on RGFW: Single-header C99 window abstraction library
Nope, most people using it know how to link and compile libraries. :)
colleagueRiley··on RGFW: Single-header C99 window abstraction library
Well for one you're able to easily use macros to customize features you want and don't want. Plus "forcing me to figure out the specific XYZ_IMPLEMENTATION" is a big of a weird compliant. You could say the same thing about linking a library. Besides, it's not hard to figure out and is usually one of the first lines of the file.

The single-header format also gives you MORE ways to compile the library and control which features to use or not use.

colleagueRiley··on RGFW: Single-header C99 window abstraction library
Oh, I wasn't sure if that was you :)

Thanks for the advice, I'm a little worried about breaking compatibility with compilers that don't support stdint. But if it's standard for C99 thing then sure.

colleagueRiley··on RGFW: Single-header C99 window abstraction library
I use those by default although I read that MSVC's support for those are iffy. I'm pretty sure STB does the same thing for the same reason.

Source: https://handmade.network/forums/articles/t/7138-how_to_write...

colleagueRiley··on RGFW: Single-header C99 window abstraction library
:( That's disappointing, but I understand.
colleagueRiley··on RGFW: Single-header C99 window abstraction library
Yes, because MSVC may or may not have stdint.h
colleagueRiley··on RGFW: Single-header C99 window abstraction library
Okay, thank you.
colleagueRiley··on RGFW: Single-header C99 window abstraction library
https://github.com/SasLuca/glfw-single-header/blob/master/ex...
colleagueRiley··on RGFW: Single-header C99 window abstraction library
Minimal refers to the code itself.

GLFW's codebase is ~10MB while RGFW's is about ~300kb. But RGFW tries to support nearly everything that GLFW supports.

colleagueRiley··on RGFW: Single-header C99 window abstraction library
I test Windows mainly with MINGW, that might be an issue with MSVC. Feel free to report the issue on the github repository.

I'm pretty sure windows uses "long" for 64 bit but linux uses "long long" for 64 bit

colleagueRiley··on RGFW: Single-header C99 window abstraction library
Try putting GLFW's source code into one file and then compile it. That will take at least a few seconds, RGFW compiles in less than a second.

Where's the bloat? :)

https://github.com/SasLuca/glfw-single-header/blob/master/ex...

colleagueRiley··on RGFW: Single-header C99 window abstraction library
Even then, that's what GLFW is designed to do, and it's entire source code is still far larger than RGFW's.
colleagueRiley··on RGFW: Single-header C99 window abstraction library
I just have the Makefile do the code generation, it would be annoying for the user, but they can complain to Wayland if they don't like it.
colleagueRiley··on RGFW: Single-header C99 window abstraction library
Sure, but none of these are true alternatives because they are missing a lot of features that libraries like GLFW or RGFW have.

(They may be good alternatives for certain use-cases)

colleagueRiley··on RGFW: Single-header C99 window abstraction library
- Better API design - Not being experimental after 11 years

I think that Wayland actually has some steps in the right direction, but overall I don't think it's actually a very good alternative. It's way more low-level than X11 and a lot of higher level features, like window decorations, are not even officially supported.

colleagueRiley··on RGFW: Single-header C99 window abstraction library
We'd be at the same spot, single-header files are still useful.

A single-header file is not a 'full-sized' library compressed into one file it's codebase is designed to actually be minimalist. Many libraries have single files that are the same size as their alternative single-header.

colleagueRiley··on RGFW: Single-header C99 window abstraction library
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··on RGFW: Single-header C99 window abstraction library
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. :)

colleagueRiley··on RGFW: Single-header C99 window abstraction library
X11 needs a real alternative :(
colleagueRiley··on RGFW: Single-header C99 window abstraction library
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.

colleagueRiley··on RGFW: Single-header C99 window abstraction library
I'm aware of the errors for the micro UI (on the web), it's something I plan on looking into soon!
colleagueRiley··on RGFW: Single-header C99 window abstraction library
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.

colleagueRiley··on RGFW: Single-header C99 window abstraction library
Thanks :)
colleagueRiley··on RFont – modular easy-to-use single-header font library, OpenGL modern and legacy
Simple single header modular font rendering library The library is designed to be lightweight while also supporting the ablitiy to add your own rendering system.
colleagueRiley··on RGFW – Super Lightweight Single-Header GLFW Alternative
RGFW is an very easy-to-use, lightweight, single-header alternative for something like GLFW. It is made to be far easier more convenient for the user to use to make software, especially libraries. The single-header-file format also makes it very portable.