Python bindings for RGFW,
RGFW is a free multi-platform single-header very simple-to-use framework library for creating GUI Libraries or simple GUI programs. it is meant to be used as a very small and flexible alternative library to GLFW.
The window backend supports XLib (UNIX), Cocoas (MacOS) and WinAPI (Windows)
The graphics backend supports OpenGL (EGL, software, OSMesa, GLES), Vulkan, DirectX and software rendering buffers.
RGFW was designed as a backend for RSGL, but it can be used standalone or for other libraries, such as Raylib which uses it as an optional alternative backend.
This library
- is single header and portable (written in C89 in mind)
- is very small compared to other libraries
- only depends on system API libraries, Winapi, X11, Cocoa
- 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
This library does not
- Handle any rendering for you (other than creating your graphics context)
- do anything above the bare minimum in terms of functionality
To build the python binding simple run
make build
you can also run make
to build and then run an example program or make debug
to build from scratch then run an example program.
A basic example can be found in basic.py
, it includes a basic OpenGL example of just about all of RGFW's functionalities.
import RGFW
from OpenGL.GL import *
icon = [0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF]
def main():
win = RGFW.createWindow("name", RGFW.rect(500, 500, 500, 500), RGFW.CENTER)
win.setIcon(icon, RGFW.area(3, 3), 4)
running = 1
while (running):
while (win.checkEvent()):
if (win.event.type == RGFW.quit or RGFW.isPressedI(win, RGFW.Escape)):
running = 0
break
win.swapBuffers()
glClearColor(0xFF, 0XFF, 0xFF, 0xFF)
glClear(GL_COLOR_BUFFER_BIT)
win.close()
main()
- email : [email protected]
- discord : ColleagueRiley
- discord server : https://discord.gg/pXVNgVVbvh
More information about RGFW can be found on the RGFW repo
There is a lot of in-header-documentation, but more documentation can be found here
If you wish to build the documentation yourself, there is also a Doxygen file attached.
RGFW is more portable, in part because single-header library. It does not use callbacks and focuses on trying to be straightforward. RGFW tries to work with the programmer rather than forcing the programmer to work around it. It also uses far less RAM and storage than GLFW.
Feature | RGFW | GLFW |
---|---|---|
.o size (avg) | 46kb | 280kb |
.so size (avg) | 94kb | 433kb |
.h size | 152kb | 256kb |
basic demo lines | ~130 | ~160 |
memory ussage (linux) | 47 Mib | 55.9 Mib |
--- | --- | --- |
fps counter | ✓ | X |
multi-threading | ✓ | X |
drag and drop (input) | ✓ | ✓ |
drag and drop (output) | X | X |
joystick input | ~ (no macos support) | ✓ |
live window struct | ✓ | X |
event pipeline (dynamic) | ✓ | X |
multi-buffering | ✓ | ✓ |
set icon based on bitmap | ✓ | ✓ |
clipboard I/O | ✓ | ✓ |
multi-window support | ✓ | ✓ |
hide/show mouse | ✓ | ✓ |
no resize window | ✓ | ✓ |
no border window | ✓ | X |
transparent window | ✓ | ✓ |
key strings | ✓ | ✓ |
custom cursors | ✓ | ✓ |
wayland | ~ (backwards comp.) | ✓ |
OpenGL | ✓ | ✓ |
Vulkan | ✓ | ✓ |
OpenGL ES | ✓ | ✓ |
EGL | ✓ | ✓ |
OSMesa | ✓ | ✓ |
Direct X | ✓ | X |