RSGL is A modular simple-to-use cross-platform GUI library for easily creating GUI apps and games. It combines the freedom of lower-level GUI libraries with modern C techniques, offering both simplicity and convenience. Its main features are its built in lightweight dependence and its flexibility, its cross platform support. It currently supports Linux, Windows and MacOS, has a zlib license, and due to its use of STB and miniaudio, supports many data formats.
https://github.com/ColleagueRiley/RSGL
RSGL, short for Riley's Simple GUI Library, is a tool designed to streamline the development of graphical user interfaces (GUIs) for applications and games. At its core, RSGL serves as a modular and cross-platform solution, offering developers the freedom to create GUIs easily while overcoming common challenges encountered in GUI development.
By encapsulating essential GUI functionalities within a lightweight and versatile library, RSGL empowers developers to focus on creativity rather than wrestling with technical complexities.
Much like SDL RSGL tries to not get in the users way. But unlike SDL, RSGL tries to be more modernized and do more for the user. Another library RSGL can be compared to is Raylib. I did not know about Raylib until after I had already created my initial design of RSGL. On the surface Raylib and RSGL have very similar designs. Although, RSGL has different design choices and a stronger focus on being lightweight. For example, all of RSGL's internal dependencies are very lightweight and most are designed to be so. While the dependencies Raylib uses are not designed to be lightweight, such as GLFW. RSGL uses RGFW instead of GLFW, the .o output of GLFW is ~280kb while RGFW's is ~46kb. Nevertheless Raylib and RSGL and both good choices for a GUI Library and the one you choose to use might change depending on your taste and circumstance.
Another similarity between Raylib and RSGL is that they both use OpenGL abstraction layers. RLGL and RGL respectively. I won't go into too much detail on the differences here. But it is very important to note how these both make their respective library all that stronger. The software creator can easily compile between modern and legacy OpenGL. RGL also allows the program to render using legacy functions during runtime. This allows the program to have a fail safe, just another way RSGL provides convenience to the user.
Enough talking about how great RSGL is. Here is an example so you can decide for yourself is RSGL is really worth all the praise.
#define RSGL_NO_AUDIO /* we don't want to link with miniaudio.h */ #define RSGL_IMPLEMENTATION #include "RSGL.h" #include <stdbool.h> int main() { /* create window and pass arg to make sure it's centered */ RSGL_window* win = RSGL_createWindow("example", RSGL_RECT(0, 0, 500, 500), RSGL_CENTER); bool legacy = false; bool running = true; while(running) { /* check events until there are no more events to check */ while(RSGL_window_checkEvent(win)) { if (win->event.type == RGFW_quit || RSGL_isPressedI(win, RGFW_Escape)) { running = false; break; } /* if the space bar is pressed, toggle rendering using opengl legacy */ if (win->event.type == RSGL_keyPressed && win->event.keyCode == RGFW_Space) { legacy = !legacy; RSGL_legacy(legacy); } } /* draw a basic rectangle and clear the screen */ RSGL_drawRect(RSGL_RECT(200, 200, 200, 200), RSGL_RGB(255, 0, 0)); RSGL_window_clear(win, RSGL_RGB(255, 255, 255)); } RSGL_window_close(win); }
Compiling :
windows : gcc -lopengl32 -lshell32 -lgdi32
linux: gcc -lGLX -lX11 -lm
macos : gcc -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo
NOTE : This is a very basic example, there are plenty far less basic examples included in the repo.
The overall features of RSGL, as bulleted list are :
RSGL_NO_WIDGETS (makes it so RSGL doesn't include widget functions)
RSGL_NO_AUDIO (makes it so RSGL doesn't include audio functions)
RSGL_NO_WINDOW - no RSGL_window, RSGL_graphics is used instead [this is for using a differnt window manager other than RGFW ]
RSGL_NO_TEXT - do not include text rendering functions
RGFW_NO_WIDGETS - do not include widgets
RSGL_NO_AUDIO - do not include audio functions
RSGL_NO_MINIAUDIO_IMPLEMENTATION - do not have #define MINIAUDIO_IMPLEMENTATION in
this header (you'll have to link miniaudio some other way to use audio)
RSGL_NO_SAVE_IMAGE - do not save/load images (don't use RSGL_drawImage if you use this),
RSGL_drawImage saves the file name + texture so it can load it
when you ask for it later. This disables that
RSGL uses the libpng license, this means you can use RSGL freely as long as you do not claim you wrote this software, mark altered versions as such and keep the license included with the header.
The RSGL Repo can be found at :
https://github.com/ColleagueRiley/RSGL
The above is the detailed content of RSGL | Modular header-only cross-platform GUI Library for easily creating GUI software your way!. For more information, please follow other related articles on the PHP Chinese website!