{"id":20950454,"url":"https://github.com/colleagueriley/rgfw","last_synced_at":"2025-05-14T03:32:35.562Z","repository":{"id":128522228,"uuid":"605157846","full_name":"ColleagueRiley/RGFW","owner":"ColleagueRiley","description":"A multi-platform single-header very simple-to-use framework library for creating GUI Libraries or simple GUI programs. ","archived":false,"fork":false,"pushed_at":"2024-05-22T21:24:01.000Z","size":2790,"stargazers_count":111,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-22T21:28:01.837Z","etag":null,"topics":["cocoa","cross-platform","directx","glfw","graphics","gui","library","lightweight","macos","macosx","opengl","pure-c","rsgl","silicon","silicon-h","single-header","unix","vulkan","winapi","xlib"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ColleagueRiley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-22T15:11:43.000Z","updated_at":"2024-06-02T00:45:31.296Z","dependencies_parsed_at":"2023-06-03T19:45:46.752Z","dependency_job_id":"b5e6fb1c-f7f7-4efb-b6dd-10d3f5e46a61","html_url":"https://github.com/ColleagueRiley/RGFW","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ColleagueRiley%2FRGFW","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ColleagueRiley%2FRGFW/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ColleagueRiley%2FRGFW/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ColleagueRiley%2FRGFW/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ColleagueRiley","download_url":"https://codeload.github.com/ColleagueRiley/RGFW/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225275711,"owners_count":17448387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cocoa","cross-platform","directx","glfw","graphics","gui","library","lightweight","macos","macosx","opengl","pure-c","rsgl","silicon","silicon-h","single-header","unix","vulkan","winapi","xlib"],"created_at":"2024-11-19T00:48:43.105Z","updated_at":"2025-05-14T03:32:35.555Z","avatar_url":"https://github.com/ColleagueRiley.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Riley's Graphics library FrameWork\n![THE RGFW Logo](https://github.com/ColleagueRiley/RGFW/blob/main/logo.png?raw=true)\n\n## Build statuses\n![workflow](https://github.com/ColleagueRiley/RGFW/actions/workflows/linux.yml/badge.svg)\n![workflow windows](https://github.com/ColleagueRiley/RGFW/actions/workflows/windows.yml/badge.svg)\n![workflow macOS](https://github.com/ColleagueRiley/RGFW/actions/workflows/macos.yml/badge.svg)\n\n[![Discord Members](https://img.shields.io/discord/829003376532258816.svg?label=Discord\u0026logo=discord)](https://discord.gg/pXVNgVVbvh) \n\nmatrix: [![Matrix](https://img.shields.io/matrix/rsgl-is-sili%3Amatrix.org)](https://matrix.to/#/#rsgl-is-sili:matrix.org)\n\nA cross-platform lightweight single-header very simple-to-use window abstraction library for creating graphics Libraries or simple graphical programs. Written in pure C99.\n\n# About\nRGFW is a free multi-platform single-header very simple-to-use window abstraction framework for creating graphics Libraries or simple graphical programs. It is meant to be used as a very small and flexible alternative library to GLFW. \n\nThe window backend supports XLib (UNIX), Cocoas (MacOS), wasm (emscripten) and WinAPI (tested on windows *XP*, 10 and 11, and reactOS)\\\nWindows 95 \u0026 98 have also been tested with RGFW, although results are iffy  \n\nWayland: to compile wayland add (RGFW_WAYLAND=1). Wayland support is very experimental and broken.\n\nThe graphics backend supports OpenGL (EGL, software, OSMesa, GLES), Vulkan, DirectX, [Metal](https://github.com/RSGL/RGFW-Metal) and software rendering buffers.\n\nRGFW 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.\n\nRGFW is multi-paradigm,\\\nBy default RGFW uses a flexible event system, similar to that of SDL, however you can use callbacks if you prefer that method. \n\nThis library\n\n1) is single header and portable (written in C99 in mind)\n2) is very small compared to other libraries\n3) only depends on system API libraries, Winapi, X11, Cocoa\n4) 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 \n5) is customizable, you enable or disable features\n\nThis library does not\n\n1) Handle any rendering for you (other than creating your graphics context)\n2) do anything above the bare minimum in terms of functionality \n\n# Getting started\n## a very simple example\n```c\n#define RGFW_IMPLEMENTATION\n#include \"RGFW.h\"\n\n#include \u003cstdio.h\u003e\n\nvoid keyfunc(RGFW_window* win, RGFW_key key, char keyChar, RGFW_keymod keyMod, RGFW_bool pressed) {\n    if (key == RGFW_escape \u0026\u0026 pressed) {\n        RGFW_window_setShouldClose(win);\n    }\n}\n\nint main() {\n    RGFW_window* win = RGFW_createWindow(\"a window\", RGFW_RECT(0, 0, 800, 600), RGFW_windowCenter | RGFW_windowNoResize);\n\n    RGFW_setKeyCallback(keyfunc); // you can use callbacks like this if you want\n\n    while (RGFW_window_shouldClose(win) == RGFW_FALSE) {\n        while (RGFW_window_checkEvent(win)) {  // or RGFW_window_checkEvents(); if you only want callbacks\n            // you can either check the current event yourself\n            if (win-\u003eevent.type == RGFW_quit) break;\n            \n            if (win-\u003eevent.type == RGFW_mouseButtonPressed \u0026\u0026 win-\u003eevent.button == RGFW_mouseLeft) {\n                printf(\"You clicked at x: %d, y: %d\\n\", win-\u003eevent.point.x, win-\u003eevent.point.y);\n            }\n\n            // or use the existing functions\n            if (RGFW_isMousePressed(win, RGFW_mouseRight)) {\n                printf(\"The right mouse button was clicked at x: %d, y: %d\\n\", win-\u003eevent.point.x, win-\u003eevent.point.y);\n            }\n        }\n        \n        glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n        glClear(GL_COLOR_BUFFER_BIT);\n\n        // You can use modern OpenGL techniques, but this method is more straightforward for drawing just one triangle.\n        glBegin(GL_TRIANGLES);\n        glColor3f(1, 0, 0); glVertex2f(-0.6, -0.75);\n        glColor3f(0, 1, 0); glVertex2f(0.6, -0.75);\n        glColor3f(0, 0, 1); glVertex2f(0, 0.75);\n        glEnd();\n\n        RGFW_window_swapBuffers(win);\n    }\n\n    RGFW_window_close(win);\n    return 0;\n}\n```\n\n```sh\nlinux : gcc main.c -lX11 -lGL -lXrandr\nwindows : gcc main.c -lopengl32 -lgdi32\nmacos : gcc main.c -framework CoreVideo -framework Cocoa -framework OpenGL -framework IOKit\n```\n\n## Dynamic Linking with XDL.h\nXDL can be used to dynamically link X11 functions to RGFW using `dl`. It allows X11 functions to loaded at runtime.\n\nTo enable RGFW's use of XDL, add this line to your code:\n\n```c\n#define RGFW_USE_XDL\n```\n\n## Linking OpenGL is not required\nThis only applies to Windows, macOS and X11 (with `XDL.h`):\n    \n    \nBy default, OpenGL does not need to be explicitly linked unless you are directly using OpenGL functions in your code. If you rely on a OpenGL loader library, you don't need to explicitly link OpenGL at all!\n\n    \nThe examples/gl33/gl33 example demonstrates using OpenGL without explicitly linking it. \n\n## other examples\n![examples](screenshot.PNG)\n\nYou can find more examples [here](examples) or [run it in your browser](https://colleagueriley.github.io/RGFW/) with emscripten\n\n# Officially tested Platforms \n- Windows (ReactOS, XP, Windows 10, 11)\n- Linux\n- MacOS (10.13, 10.14, 10.15) (x86_64)\n- HTML5 (wasm / Emscripten)\n- Raspberry PI OS\n\n# Supported GUI libraries\nA list of GUI libraries that can be used with RGFW can be found on the RGFW wiki [here](https://github.com/ColleagueRiley/RGFW/wiki/GUI-libraries-that-can-be-used-with-RGFW)\n\n# Documentation\nThere is a lot of in-header-documentation, but more documentation can be found at https://colleagueriley.github.io/RGFW/docs/index.html\nIf you wish to build the documentation yourself, there is also a Doxygen file attached.\n\n# Bindings\nA list of bindings can be found on the RGFW wiki [here](https://github.com/ColleagueRiley/RGFW/wiki/Bindings)\n\n# projects\nA list of projects that use RGFW can be found on the RGFW wiki [here](https://github.com/ColleagueRiley/RGFW/wiki/Projects-that-use-RGFW)\n\n# Contacts\n- email : ColleagueRiley@gmail.com \n- discord : ColleagueRiley\n- discord server : https://discord.gg/pXVNgVVbvh\n- matrix space: https://matrix.to/#/#rsgl-is-sili:matrix.org\n- BlueSky https://bsky.app/profile/colleagueriley.bsky.social\n- Twitter/X : https://x.com/ColleagueRiley\n\n# Supporting RGFW\n  There is a RGFW wiki page about things you can do if you want to support the development of RGFW [here](https://github.com/ColleagueRiley/RGFW/wiki/Supporting-RGFW).\n\n# RGFW vs GLFW\nA comparison of RGFW and GLFW can be found at [on the wiki](https://github.com/ColleagueRiley/RGFW/wiki/RGFW-vs-GLFW)\n\n# License\nRGFW uses the Zlib/libPNG license, this means you can use RGFW 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.\n\n```\nPermission is granted to anyone to use this software for any purpose,\nincluding commercial applications, and to alter it and redistribute it\nfreely, subject to the following restrictions:\n  \n1. The origin of this software must not be misrepresented; you must not\n   claim that you wrote the original software. If you use this software\n   in a product, an acknowledgment in the product documentation would be\n   appreciated but is not required. \n2. Altered source versions must be plainly marked as such, and must not be\n   misrepresented as being the original software.\n3. This notice may not be removed or altered from any source distribution.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolleagueriley%2Frgfw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcolleagueriley%2Frgfw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolleagueriley%2Frgfw/lists"}