package raylib

  1. Overview
  2. Docs
OCaml bindings for raylib

Install

Dune Dependency

Authors

Maintainers

Sources

raylib-ocaml-0.1.tar.gz
md5=a35e88680caccd5a519cb859d2d7ae6a
sha512=f8e8ed46afe903485c81964c54d434911e208ea9a8a853599cc368860f106ebc3872205c51b40b8148140cd1288447e68737313cd065cdc8d7207043f0bc0758

Description

Published: 28 Aug 2020

README

README.md

raylib-ocaml

OCaml bindings for raylib (v3.0.0), a simple and easy-to-use library to enjoy videogames programming.

The bindings are pretty faithful to the original C code, the biggest difference is the conversion of all function names from CamelCase to snake_case. Wherever possible, integer arguments are changed to their own variant types, eg. int key to Key.t.

Bindings exist for (nearly) all functions and types, but only a subset are tested thus far (see examples folder). Rough edges are to be expected.

Example

let setup () =
  Raylib.init_window 800 450 "raylib [core] example - basic window";
  Raylib.set_target_fps 60

let rec loop () =
  match Raylib.window_should_close () with
  | true -> Raylib.close_window ()
  | false ->
      let open Raylib in
      begin_drawing ();
      clear_background Color.raywhite;
      draw_text "Congrats! You created your first window!" 190 200 20
        Color.lightgray;
      end_drawing ();
      loop ()

let () = setup () |> loop

Further examples can be found in the examples folder.

Building

Currently, the automated build works only on Linux. A Windows build (mingw64 pins) is possible, but requires a bit of manual fiddling. The library is built with cmake from source, therefore cmake and raylib's dependencies must be present, for details see here.

From the OCaml side, the library depends on ctypes and ppx_cstubs and uses dune as its build system:

dune build

This also builds the examples.

TODO

  • Write further tests to cover the whole surface of raylib

  • Split the library into components (core, sound, 3D, VR etc) for a smaller memory footprint

  • Provide some ergonomics (somehow?)

Dev Dependencies

None

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.