Skip to content

MaintainersWanted/OCamlSDL

Repository files navigation

OCamlSDL

OCamlSDL - An interface between OCaml and SDL 1.2

Overview

The goal of OCamlSDL is to provide access the multimedia hardware in the ML programming language with the help of the SDL library. The Simple DirectMedia Layer is a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.

OCamlSDL is hosted on Github :

https://github.com/ocamlsdl/OCamlSDL

was previously hosted on SourceForge.net: http://ocamlsdl.sourceforge.net/ http://www.sourceforge.net/projects/ocamlsdl/

Requirements

OCamlSDL needs the following software and libraries:

* OCaml		http://www.ocaml.org/  (since 3.04, working with 4.01)
* SDL       http://www.libsdl.org/ (1.2.x)

and optionally:

* SDL_ttf		http://www.libsdl.org/projects/SDL_ttf/   (2.x)
* SDL_mixer	http://www.libsdl.org/projects/SDL_mixer/ (1.2.x)
* SDL_image	http://www.libsdl.org/projects/SDL_image/ (1.2.x)
* SDL_gfx         http://www.ferzkopp.net/joomla/software-mainmenu-14/4-ferzkopps-linux-software/19-sdlgfx
* LablGL		http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgl.html
* findlib		http://projects.camlcity.org/projects/findlib.html

Using

See the INSTALL file (and INSTALL.win32) for information on how to compile and install the library.

The library use the Bigarray module (distributed with OCaml), to interface with C so programs using OCamlSDL must also be linked with bigarray. Example :

$ ocamlc -c -I /path/to/ocamlsdl my_prog.ml
$ ocamlc -o my_prog -I /path/to/ocamlsdl bigarray.cma sdl.cma sdttf.cma my_prog.cmo

If OCamlSDL was installed using findlib, the package manager will take care of that:

$ ocamlfind ocamlc -c -package sdlttf -linkpkg my_prog.ml
$ ocamlfind ocamlc -o my_prog -package sdlttf -linkpkg my_prog.cmo

MacOSX users should also read README.macosx.

Documentation

You can browse the ocaml API documentation at: http://ocamlsdl.sourceforge.net/docs/index.html

You can find SDL documentation on the SDL website: http://www.libsdl.org/

Toplevel

You can build a custom toplevel including OCamlSDL libraries with:

$ ocamlmktop -o ocamlsdl -I /path/to/ocamlsdl -custom bigarray.cma sdl.cma ...

If you use OCaml >= 3.04, the static toplevel is not really necessary since you can dynamically load OCamlSDL in the toplevel:

$ ocaml
     Objective Caml version 3.04

# #load "bigarray.cma" ;;
# #load "sdl.cma" ;;
#

Feedback

Bugs can be reported on the Github project page.

-- The OCamlSDL developers