{"id":13726067,"url":"https://github.com/tjammer/raylib-ocaml","last_synced_at":"2025-12-25T14:28:23.313Z","repository":{"id":37621018,"uuid":"290883538","full_name":"tjammer/raylib-ocaml","owner":"tjammer","description":"OCaml bindings for raylib and raygui","archived":false,"fork":false,"pushed_at":"2025-12-13T21:41:44.000Z","size":8068,"stargazers_count":223,"open_issues_count":7,"forks_count":20,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-12-15T16:20:42.588Z","etag":null,"topics":["gamedev","imgui","ocaml","raylib"],"latest_commit_sha":null,"homepage":"https://tjammer.github.io/raylib-ocaml/","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tjammer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-08-27T21:16:05.000Z","updated_at":"2025-12-09T13:40:13.000Z","dependencies_parsed_at":"2024-01-06T02:02:54.077Z","dependency_job_id":"49b26810-3b77-4fea-9132-d0a8647437f7","html_url":"https://github.com/tjammer/raylib-ocaml","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/tjammer/raylib-ocaml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjammer%2Fraylib-ocaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjammer%2Fraylib-ocaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjammer%2Fraylib-ocaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjammer%2Fraylib-ocaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tjammer","download_url":"https://codeload.github.com/tjammer/raylib-ocaml/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjammer%2Fraylib-ocaml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28031137,"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","status":"online","status_checked_at":"2025-12-25T02:00:05.988Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["gamedev","imgui","ocaml","raylib"],"created_at":"2024-08-03T01:02:51.445Z","updated_at":"2025-12-25T14:28:23.305Z","avatar_url":"https://github.com/tjammer.png","language":"OCaml","funding_links":[],"categories":["OCaml"],"sub_categories":[],"readme":"![logo](images/logo.png)\n\n# raylib-ocaml\n\nOCaml bindings for \u003ca href=\"https://www.raylib.com/\" target=\"_blank\"\u003eraylib\u003c/a\u003e (5.0.0), a simple and easy-to-use library to enjoy videogames programming.\n\nThe documentation can be viewed [online](https://tjammer.github.io/raylib-ocaml/raylib/Raylib/index.html).\n\nThe bindings are pretty faithful to the original C code, the biggest difference is the conversion of all function names from CamelCase to snake_case.\nWherever possible, integer arguments are changed to their own variant types, eg. `int key` to `Key.t`.\n\nBindings exist for (nearly) all functions and types, but only a subset are tested thus far (see examples folder). Contributions are welcome.\n\n## Example\n\n``` ocaml\nlet setup () =\n  Raylib.init_window 800 450 \"raylib [core] example - basic window\";\n  Raylib.set_target_fps 60\n\nlet rec loop () =\n  if Raylib.window_should_close () then Raylib.close_window ()\n  else\n    let open Raylib in\n    begin_drawing ();\n    clear_background Color.raywhite;\n    draw_text \"Congrats! You created your first window!\" 190 200 20\n      Color.lightgray;\n    end_drawing ();\n    loop ()\n\nlet () = setup () |\u003e loop\n```\nMore examples can be found in the examples folder.\n\nAlthough the original raylib is written in C, most functions take their arguments by value, which maps nicely to a functional language like OCaml. In the few cases where pointers are needed for arrays (mainly the 3D part of raylib), raylib-ocaml tries to use the `CArray` type of ctypes, which it also re-exports in the main `Raylib` module.\n\n## Installation\n\nDuring the build of raylib-ocaml, the raylib C library is built from source, therefore its dependencies must be installed (\u003ca href=\"https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux\" target=\"_blank\"\u003edetails here\u003c/a\u003e).\nFor some distros, depexts exist (feel free to contribute depexts for missing distros) to automatically install these dependencies:\n\n``` sh\nopam depext raylib\n```\n\nraylib-ocaml can be installed via `opam`:\n\n``` sh\nopam install raylib\n```\n\n## Examples\nTo build the examples, make sure the raylib C submodule is available with `git\nsubmodule update --init --recursive`, and that all needed dependencies are\ninstalled.\n\n``` sh\nopam install . --deps-only\n```\n\nFinally, simply\n``` sh\ndune build\n```\ninside this repo. The binaries can then be found in `_build/default/examples`.\n\n## Raygui\nIn addition to raylib, there are bindings to \u003ca href=\"https://github.com/raysan5/raygui\" target=\"_blank\"\u003eraygui\u003c/a\u003e, an immediate mode gui library which complements raylib.\nThe documentation of the raygui bindings can be viewed [online](https://tjammer.github.io/raylib-ocaml/raygui/Raygui/index.html) as well.\nAs with the raylib bindings, the bindings stick close to the C source.\nAn exception to this are the `*_style` functions, which take a polymorphic variant.\nAn example can be found in `examples/gui`.\n\n![gui_example](images/raygui.gif)\n\n## TODO\n* Split the library into components (core, sound, 3D, VR etc) for a smaller memory footprint\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftjammer%2Fraylib-ocaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftjammer%2Fraylib-ocaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftjammer%2Fraylib-ocaml/lists"}