RGFW | Lightweight Single-header window abstraction library.

RGFW

RGFW is a lightweight single-header library that handles window creation and management, including helpers to create for graphics context creation, for DirectX, Metal, OpenGL, Vulkan, WebGPU, or software rendering.

https://github.com/ColleagueRiley/RGFW

RGFW's design

RGFW is also designed to be more flexible so it can easily fit into any project. It allows for varying methods of event handling to best fit the user's needs. RGFW supports event queues, callbacks or state-checking functions.

examples

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 headless RGFW example to get started with

#define RGFW_IMPLEMENTATION
#include "RGFW.h"

int main(void) {
    RGFW_window* win = RGFW_createWindow("name", 500, 500, 500, 500, RGFW_windowCenter);

    while (!RGFW_window_shouldClose(win)) {
        RGFW_event event;
        while (RGFW_window_checkEvent(win, &event)) {
            if (event.type == RGFW_windowClose)
                break;
        }
    }

    RGFW_window_close(win);
}

This can be compiled with:

gcc main.c -lX11 -lXrandr -lm, on linux

gcc main.c -lgdi32 -lwinmm, on windows

gcc main.c -lm -framework Foundation -framework AppKit -framework CoreVideo, on macOS

screenshot.PNG

last note

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 WASM at https://colleagueriley.github.io/RGFW/


Edited by colleagueRiley on Reason: Update RGFW code, remove GLFW points