{"id":19676123,"url":"https://github.com/sasluca/rayfork","last_synced_at":"2025-04-06T09:08:43.242Z","repository":{"id":47214632,"uuid":"228938024","full_name":"SasLuca/rayfork","owner":"SasLuca","description":"C99 Game Library. XNA-like. Platform Independent. Allocator Aware.","archived":false,"fork":false,"pushed_at":"2023-11-16T08:14:48.000Z","size":67516,"stargazers_count":337,"open_issues_count":9,"forks_count":21,"subscribers_count":15,"default_branch":"rayfork-0.9","last_synced_at":"2025-03-30T07:11:36.251Z","etag":null,"topics":["c","cross-platform","game-engine","games-library","platform-independent","raylib"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SasLuca.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2019-12-18T23:25:18.000Z","updated_at":"2025-03-24T06:04:31.000Z","dependencies_parsed_at":"2024-12-24T04:29:15.241Z","dependency_job_id":null,"html_url":"https://github.com/SasLuca/rayfork","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SasLuca%2Frayfork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SasLuca%2Frayfork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SasLuca%2Frayfork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SasLuca%2Frayfork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SasLuca","download_url":"https://codeload.github.com/SasLuca/rayfork/tar.gz/refs/heads/rayfork-0.9","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247457802,"owners_count":20941906,"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":["c","cross-platform","game-engine","games-library","platform-independent","raylib"],"created_at":"2024-11-11T17:27:15.594Z","updated_at":"2025-04-06T09:08:43.225Z","avatar_url":"https://github.com/SasLuca.png","language":"C","readme":"\u003cdiv align=\"center\"\u003e\u003cimg src=\"graphics/logo.png\" width=\"256\"/\u003e\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\u003ci\u003eC99 • Single Source • Platform Independent • XNA-like • Allocator-Aware • Game Dev Library\u003c/i\u003e\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\u003ch3\u003e\n  \u003ca href=\"https://github.com/SasLuca/rayfork/releases\"\u003e DOWNLOAD HERE \u003c/a\u003e\n  \u003ca\u003e • \u003c/a\u003e\n  \u003ca href=\"https://github.com/SasLuca/rayfork-sokol-template\"\u003e GITHUB TEMPLATE \u003c/a\u003e\n\u003c/h3\u003e\u003c/div\u003e\n\n\u003cbr\u003e\u003c/br\u003e\n\nForked from the awesome raylib game framework: https://www.raylib.com/\n\n**NOTICE:** rayfork is still under very early development and it is not recommended that you use it professionally at the moment.\n\n## How to build\n\nrayfork only has one .c file and only depends on libc, which means it can be easily compiled as a library from the command line.\n\n```shell script\n# -c compiles the code as a library\n# -EHsc disables exceptions on msvc\n\ngcc -c rayfork.c\nclang -c rayfork.c\ncl -c -EHsc rayfork.c\n```\n\n## Principles\n\n### 1. Provide platform-independent code\n\nrayfork does not provide a platform layer, that means it won't create a window, load OpenGL, or capture input for you.\n\nThis is by design, so that you can easily use rayfork on multiple platforms (including game consoles) by using the method that works best for you. \nThere are templates for using rayfork with GLFW, SDL, sokol-app and custom platform layers.\n\nThe renderer currently has OpenGL33 and OpenGL-ES3 backends (with more to be added) that are implemented in a portable way which allows rayfork to be compiled on any platform, \nwith the only dependency being libc. OpenGL procs are passed explicitly to rayfork and there is a simple macro to aid with this.  \n\nBecause of this you can easily compile rayfork for any platform be it PC, Mobile or Consoles.\n\n### 2. Provide full control over IO and memory\n\nFunctions that do IO are often optional and explicitly ask for IO callbacks. A simple wrapper for the libc IO functions is provided as `rf_default_io`.\n\nFunctions that allocate explicitly ask for an allocator and sometimes also for a temporary memory allocator (memory that is freed inside the function). A simple wrapper for libc's malloc/free is provided as `rf_default_allocator`.\n\nAll dependencies are also used with custom allocators in mind, the library will never allocate without you knowing.\n\nEvery function that requires an allocator or io callbacks has an `_ez` version which wraps the original function and calls it with `rf_default_allocator` and/or `rf_default_io`, this is useful for testing code quickly.\n\n### 3. Easy to build\n\nThe library is only one header and source file and can be customized at compile time using preprocessor definitions. No additional compile flags are needed, depending on the graphics backend you might need to link against certain libraries.\n\n## Rationale\n\nraylib was created initially for educational purposes and has matured over time into a very useful games library, similar to XNA. \n\nHowever, due to its nature, several design choices in raylib make it hard to use for professional game developers: \n\n- Hard to use a custom platform layer (eg: using with a custom platform layer on Android with Android Studio)\n\n- Hard to port on other platforms (eg: iOS, consoles)\n\n- Little control over memory allocations and io.\n\nrayfork is designed to address those issues and make it easy to develop professional games using the API from raylib.\n\nI started this project because I love raylib and C99 and I really wanted to develop my game using them.\n\nMany libraries however do not follow the principles that I look for in a library (see [this article](https://handmade.network/wiki/7138-how_to_write_better_game_libraries)) which makes using them in games hard/annoying which is why I want to create a library that indie developers can confidently and easily use to develop their projects without sacrificing control, portability or quality.\n\n## Help needed\n\nIf you want to be able to develop games easily with libraries that respect the principles mentioned above, please consider contributing to rayfork.\n\nYou can check the issues tab and find a lot of things you can do to contribute.\n\nI am also looking for help in developing things outside my expertise:\n- Improving the rendering API\n- More graphics backends (sokol-gfx, vulkan, custom console backends)\n- A particle system\n- Physics\n- Networking\n\n## Advice for contributors\n- Contact me on the [raylib discord server](https://discord.gg/mzCY3wN) in the #rayfork channel, I am @BananyaDev#0001, or on [twitter @SasLuca](https://twitter.com/SasLuca).\n\n- Keep the naming convention to snake case, use `rf_function_name` for interface functions and `_rf_function_name` for private functions.\n\n- Prefix all functions with `rf_public` or `RF_INTERNAL`\n\n- Don't include additional headers in the interface, work towards minimizing includes in general.\n\n- Use `#pragma region \\ #pragma endregion` for folding regions of code and consider using an editor with support for folding those regions to get an easier grasp of the code.\n\n- Try to apply the advice from [this article](https://handmade.network/wiki/7138-how_to_write_better_game_libraries) in general. \nSome of the more important advice would be:\n  - Don't allocate memory, ask the user for vertex_buffers/allocators.\n  - Don't use non constant global variables.\n  - Avoid os-dependent functions.\n\n## rayfork example running on iOS and Windows:\n\n![](https://i.gyazo.com/a61b1fa44732a4cfbf4e7e59a2c5f772.png)\n![](https://i.gyazo.com/thumb/1000/95dd519e8c6d6733acdb70f746a169fc-png.jpg)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsasluca%2Frayfork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsasluca%2Frayfork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsasluca%2Frayfork/lists"}