Git Product home page Git Product logo

rgfw-python's Introduction

RGFW-Python

THE RGFW Logo

Build statuses

workflow workflow windows workflow windows

About

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

  1. is single header and portable (written in C89 in mind)
  2. is very small compared to other libraries
  3. only depends on system API libraries, Winapi, X11, Cocoa
  4. 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

  1. Handle any rendering for you (other than creating your graphics context)
  2. do anything above the bare minimum in terms of functionality

building

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.

examples

examples

basic

A basic example can be found in basic.py, it includes a basic OpenGL example of just about all of RGFW's functionalities.

a very simple example

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()

Contacts

Documentation

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 vs GLFW

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

rgfw-python's People

Contributors

colleagueriley avatar

Watchers

 avatar

rgfw-python's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.