All Projects → tjammer → Raylib Ocaml

tjammer / Raylib Ocaml

Licence: mit
OCaml bindings for raylib

Programming Languages

ocaml
1615 projects

Labels

Projects that are alternatives of or similar to Raylib Ocaml

Excalibur
🎮 An easy to use 2D HTML5 game engine written in TypeScript
Stars: ✭ 892 (+2777.42%)
Mutual labels:  gamedev
Sadconsole
A .NET ascii/ansi console engine written in C# for MonoGame and XNA. Create your own text roguelike (or other) games!
Stars: ✭ 853 (+2651.61%)
Mutual labels:  gamedev
Session Seven
Free oldschool point & click graphic adventure game
Stars: ✭ 20 (-35.48%)
Mutual labels:  gamedev
Gdx Ai
Artificial Intelligence framework for games based on libGDX or not. Features: Steering Behaviors, Formation Motion, Pathfinding, Behavior Trees and Finite State Machines
Stars: ✭ 907 (+2825.81%)
Mutual labels:  gamedev
Librg
🚀 Making multi-player gamedev simpler since 2017
Stars: ✭ 813 (+2522.58%)
Mutual labels:  gamedev
Amethyst
Data-oriented and data-driven game engine written in Rust
Stars: ✭ 7,682 (+24680.65%)
Mutual labels:  gamedev
Ct Js
Ct.js is a desktop game engine that makes learning programming fun and game development easy by its visual editors and well-documented code library
Stars: ✭ 831 (+2580.65%)
Mutual labels:  gamedev
Imgui
Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
Stars: ✭ 33,574 (+108203.23%)
Mutual labels:  gamedev
Cr
cr.h: A Simple C Hot Reload Header-only Library
Stars: ✭ 845 (+2625.81%)
Mutual labels:  gamedev
Blit
👾 Blitting library for 2D sprites
Stars: ✭ 15 (-51.61%)
Mutual labels:  gamedev
Zelduh
A tile based adventure game!
Stars: ✭ 22 (-29.03%)
Mutual labels:  gamedev
Html5gametutorial
HTML5 game tutorial made for HTML.IT
Stars: ✭ 7 (-77.42%)
Mutual labels:  gamedev
Beaverandfairies
Stars: ✭ 14 (-54.84%)
Mutual labels:  gamedev
Feather
A Minecraft server implementation in Rust
Stars: ✭ 896 (+2790.32%)
Mutual labels:  gamedev
Space rocks
Asteroids-like game made with Godot Engine 3.0.
Stars: ✭ 20 (-35.48%)
Mutual labels:  gamedev
Awesome Gideros
A curated list of awesome Gideros resources, classes and tips.
Stars: ✭ 17 (-45.16%)
Mutual labels:  gamedev
Godot Open Rpg
Learn to create turn-based combat with this Open Source RPG demo ⚔
Stars: ✭ 855 (+2658.06%)
Mutual labels:  gamedev
Phaser
Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
Stars: ✭ 30,918 (+99635.48%)
Mutual labels:  gamedev
Yeti
⛄️ A general-purpose data-driven game engine with tools. Attribution based licensing.
Stars: ✭ 21 (-32.26%)
Mutual labels:  gamedev
Bingehack4
A replacement for bingehack. For information about in-game features and changes:
Stars: ✭ 14 (-54.84%)
Mutual labels:  gamedev

logo

raylib-ocaml

OCaml bindings for raylib (v3.5.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

More examples can be found in the examples folder.

Although 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.

Installation

During the build of raylib-ocaml, the raylib C library is built from source, therefore its dependencies must be installed (details here). For some distros, depexts exist (feel free to contribute depexts for missing distros) to automatically install these dependencies:

opam depext raylib

raylib-ocaml can be installed via opam:

opam install raylib

Examples

To build the examples, make sure the raylib C submodule is available with git submodule update --init --recursive. Then simply

dune build

inside this repo. The binaries can then be found in _build/default/examples.

TODO

  • Port more examples 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?)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].