RGFW is a lightweight single-header library that handles window creation and management, including graphics context creation (using opengl, vulkan, or directX), or software rendering.
https://github.com/ColleagueRiley/RGFW
RGFW is very similar to GLFW in terms of its use. However, RGFW is designed to be more lightweight and flexible. GLFW's full source code is a few megabytes, but even though RGFW includes most of GLFW's features, it is only ~200kb.
RGFW is also designed to be more flexible so it can easily fit into any project. It uses an event queue rather than callbacks to give the user more options for handling events. However, there is also support for optionally using event callbacks in the future.
The RGFW repo also includes some examples to help you get started, including a basic OpenGL example, software rendering, GLES, DirectX, Vulkan, and more. There are also repositories on my GitHub that use RGFW, including, RSGL, RFont, PureDoom-RGFW, and more.
Here's a very basic RGFW example to get started with
#define RGFW_IMPLEMENTATION #include "RGFW.h" int main(void) { RGFW_window* win = RGFW_createWindow("name", RGFW_RECT(500, 500, 500, 500), (u64)RGFW_CENTER); while (!RGFW_window_shouldClose(win)) { while (RGFW_window_checkEvent(win)) { if (win->event.type == RGFW_quit) break; } glClearColor(0xFF, 0XFF, 0xFF, 0xFF); glClear(GL_COLOR_BUFFER_BIT); RGFW_window_swapBuffers(win); } RGFW_window_close(win); }
This can be compiled with:
gcc main.c -lX11 -lGL -lXrandr -lm
, on linux
gcc main.c -lgdi32 -lopengl32 -lwinmm
, on windows
gcc main.c -lm -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo
, on macOS
If RGFW is interesting you, feel free to check out the repo, and if you like a star would be appreciated. https://github.com/ColleagueRiley/RGFW
The examples can also be run with webASM at https://colleagueriley.github.io/RGFW/