Orx is "an open source, portable, lightweight, plugin-based, data-driven and extremely easy to use 2D-oriented game engine." Orx itself is written in C.
This repository provides bindings to use Orx from OCaml. The sound, graphics, physics, input handling and more can be handled by Orx in C, with the game logic written in OCaml.
These bindings are licensed under the MIT license.
You will need a working build of Orx. The official beginner's guide has
instructions for installing Orx and its dependencies on your system. Make sure
the $ORX
environment variable is defined in your environment as ocaml-orx uses
that to know where the Orx shared library and C headers are.
To compile orx-ocaml you will need the following, all available from opam:
- dune
- ctypes and ctypes-foreign
- fmt
Once those are installed, you can dune build
to build the library,
dune utop src
to explore the bindings from a REPL if you have utop
installed, or dune exec examples/wiki/beginners_guide/beginners_guide.exe
to try a (slightly modified) port of the Orx beginner's guide tutorial.
The beginner's guide project has been ported to OCaml in this example.
Some of the tutorials have been ported as well.
You run run.sh to compile and execute the beginner's guide port (only tested on Linux so far).
The low level bindings are generated using ctypes stub generation and are based on the structure used in ocaml-yaml.