Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / desktop / Cocoa

RGFW | Singler-Header Lightweight Framework for Basic Window and Graphics Context Handling (like GLFW)

0.00/5 (No votes)
25 Feb 2024CPOL1 min read 4K  
A multi-platform single-header very simple-to-use framework library for creating GUI Libraries or simple GUI programs.
RGFW is a multi-platform single-header and very simple-to-use framework library used for creating GUI Libraries or simple GUI programs. It is written to be as 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 lets you create a window with a graphics context (opengl, vulkan or directX) and manage the window and its events only with a few function calls.

Image 2Introduction

RGFW is a lightweight and versatile alternative to GLFW, written in C, which puts simplicity and flexibility at the forefront of your graphics programming experience.

At its core, RGFW is designed with performance in mind. With just a single header file, it offers a portable solution that can be seamlessly integrated into your projects. Built with C89 compatibility in mind, RGFW ensures broad accessibility across different platforms and environments.

What sets RGFW apart is its focus on keeping things small and nimble. Unlike other libraries, RGFW prioritizes efficiency and simplicity, allowing you to get up and running with minimal overhead.

With RGFW, you have the power to create windows and manage events with ease, all through a handful of intuitive function calls. Whether you're working with OpenGL, Vulkan, or DirectX, RGFW provides the tools you need to handle graphics contexts effortlessly.

If you're looking for a small, flexible, and easy-to-use alternative to GLFW, look no further than RGFW. Experience the simplicity and efficiency of Riley's Gui library FrameWork and unlock the true potential of your graphics projects.

Using the Code

Below is very basic example code (in C):

C
#define RGFW_IMPLEMENTATION
#include "RGFW.h"

int main() {
    RGFW_window* win = RGFW_createWindow("name", RGFW_RECT(500, 500, 500, 500), (u64)0);
       
    while 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);
}

Example screenshots (basic and gl33)
Image 3
More Info / RGFW Repo

A table provided in the header to show specific things RGFW supports and other information about RGFW compared to GLFW:

Image 4

More information can be found on the RGFW rep and documentation can be found in the header itself, RGFW.h.

History

  • 21st February, 2024: Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)