{"id":16186938,"url":"https://github.com/robloach/raylib-app","last_synced_at":"2025-03-19T03:30:34.233Z","repository":{"id":66036480,"uuid":"549319547","full_name":"RobLoach/raylib-app","owner":"RobLoach","description":"Application wrapper for raylib","archived":false,"fork":false,"pushed_at":"2024-02-08T19:01:23.000Z","size":31,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-02-08T20:23:57.934Z","etag":null,"topics":["raylib"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RobLoach.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}},"created_at":"2022-10-11T02:20:35.000Z","updated_at":"2024-02-08T20:24:00.154Z","dependencies_parsed_at":"2023-05-20T19:15:49.425Z","dependency_job_id":null,"html_url":"https://github.com/RobLoach/raylib-app","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/RobLoach%2Fraylib-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobLoach%2Fraylib-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobLoach%2Fraylib-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobLoach%2Fraylib-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobLoach","download_url":"https://codeload.github.com/RobLoach/raylib-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244350604,"owners_count":20439283,"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":["raylib"],"created_at":"2024-10-10T07:19:53.278Z","updated_at":"2025-03-19T03:30:34.227Z","avatar_url":"https://github.com/RobLoach.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# raylib-app\n\nApplication wrapper for [raylib](https://raylib.com).\n\n## Why\n\nBuilding raylib for both the desktop and web need some subtle differences with checks against `PLATFORM`. *raylib-app* aims to clean up those differences, and make the code easier to read for a unified application entry. This pattern is inspired by [sokol_app](https://github.com/floooh/sokol#sokol_apph) and [SDL3's Main Functions](https://wiki.libsdl.org/SDL3/README/main-functions).\n\n## Usage\n\n``` c\n#include \"raylib.h\"\n\n#define RAYLIB_APP_IMPLEMENTATION\n#include \"raylib-app.h\"\n\nbool Init(void** userData, int argc, char** argv) {\n    // InitWindow() is automatically called prior to this function.\n    return true;\n}\n\nbool UpdateDrawFrame(void* userData) {\n    BeginDrawing();\n\n        ClearBackground(RAYWHITE);\n\n        DrawText(\"Congrats! You created your first raylib-app!\", 180, 200, 20, LIGHTGRAY);\n\n    EndDrawing();\n\n    // Return false to exit the application.\n    return true;\n}\n\nvoid Close(void* userData) {\n    // CloseWindow() is automatically called after this function completes.\n}\n\nApp Main(int argc, char* argv[]) {\n    return (App) {\n        .width = 800,\n        .height = 450,\n        .title = \"raylib-app [core] example - basic window\",\n        .init = Init,\n        .update = UpdateDrawFrame,\n        .close = Close,\n        .fps = 60,\n    };\n}\n```\n\n## API\n\nRather than having your own `int main()`, you will define your own `App Main(int argc char* argv[])` function.\n\n``` c\nApp Main(int argc, char* argv[]) {\n    return (App) {\n        .width = 800,                          // The width of the window\n        .height = 450,                         // The height of the window\n        .title = \"raylib-app\",                 // The window title\n        .init = Init,                          // The init callback that is called when the application initializes\n        .update = UpdateDrawFrame,             // The update callback that is called when the application should render\n        .close = Close,                        // The close callback which is called when the application is closed\n        .fps = 60,                             // The target frames-per-second\n        .configFlags = FLAG_WINDOW_RESIZABLE   // The flags that are passed to SetConfigFlags()\n    };\n}\n```\n\n## Development\n\nThere are a few ways to build raylib-app.\n\n### Desktop\n\n``` bash\ncmake -B build\ncmake --build build\n```\n\n### Web\n\n``` bash\nmkdir build\ncd build\nemcmake cmake .. -DPLATFORM=Web -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS=\"-s USE_GLFW=3\"\nemmake make\n```\n\n## License\n\n*raylib-app* is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobloach%2Fraylib-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobloach%2Fraylib-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobloach%2Fraylib-app/lists"}