DEV Community

Cover image for RGFW | Singler-Header Lightweight framework for basic window and graphics context handling (like GLFW)
Colleague Riley
Colleague Riley

Posted on

RGFW | Singler-Header Lightweight framework for basic window and graphics context handling (like GLFW)

github repo : https://github.com/ColleagueRiley/RGFW

RGFW is a single-header lightweight a multi-platform single-header very simple-to-use framework library for creating GUI Libraries or simple GUI programs. It is written to be portable as possible and supports winapi, Xlib and cocoas for windowing apis. For graphics apis it supports, OpenGL legacy, modern OpenGL, Vulkan and DirectX. It let's you create a window with an graphics context (opengl, vulkan or directX) and manage the window and it's events only with a few function calls.

More information can be found on the RGFW repo, such as table provided in the header to show specific things RGFW supports and other information about RGFW compared to GLFW. Such as that RGFW uses far less RAM and space while having a few more features than GLFW. Documentation can be found in the header itself, RGFW.h.

Below is very basic example code

#define RGFW_IMPLEMENTATION
#include "RGFW.h"

int main() {
    RGFW_window* win = RGFW_createWindow("name", 500, 500, 500, 500, (u64)0);

    RGFW_window_setIcon(win, icon, 3, 3, 4);

    i8 running = 1;

    for (running) {
        while(RGFW_window_checkEvent(win)) {
            if (win->event.type == RGFW_quit) {
               running = 0;
               break;
            }
        }

       if (RGFW_isPressedI(win, RGFW_Escape))
            break;

        RGFW_window_swapBuffers(win);

        glClearColor(0xFF, 0XFF, 0xFF, 0xFF);
        glClear(GL_COLOR_BUFFER_BIT);
    }

    RGFW_window_close(win);
}
Enter fullscreen mode Exit fullscreen mode

github repo : https://github.com/ColleagueRiley/RGFW

Top comments (0)