(raylib)

raylib-owl

WIP raylib bindings for owl lisp

api.md imported (and tweaked a bit) from janet-lang/jaylib, it is probably a bit outdated.

dependencies

how

Owl lisp supports C extensions via custom sys-prims - basically syscalls, but to C functions, not the system. You define a word prim_custom(int op, word a, word b, word c) in a C file, then call (sys-prim op a b c) from the lisp side, and then compile and link them together.

bootstraping ol-rl

ol-rl is the same thing as ol, but with compiled-in support for raylib sys-prims, so it will be then used to interpret and/or compile Owl lisp programs that depend on raylib.

$ make all
# make install

compiling stuff

$ ol-rl -o test.c test.scm
$ cc test.c -lraylib -lm -o test
$ ./test
$ wget https://pub.krzysckh.org/ol-rl.exe
$ wget https://pub.krzysckh.org/libraylib5-winlegacy.a
$ wine ol-rl.exe -o test-w32.c test.scm
$ i686-w64-mingw32-gcc -static -o test.exe -I/usr/local/include test-w32.c -L. -l:libraylib5-winlegacy.a -lm -lopengl32 -lwinmm -lgdi32 -lws2_32
$ wget https://pub.krzysckh.org/ol-rl.exe
$ wget https://pub.krzysckh.org/libraylib5-winlegacy.a
$ git clone https://github.com/raysan5/raylib
$ ol-rl.exe -o filename.c filename.scm
$ i686-w64-mingw32-gcc -static -o filename.exe -Iraylib/src filename.c -L. -lraylib5-winlegacy -lm -lopengl32 -lwinmm -lgdi32 -lws2_32
# if you don't want the console to appear when filename.exe is launched, append -mwindows to the last command

usage on ms windows

If you're on windows, you can download the pre-compiled ol-rl.exe binary here. If running it as a REPL, remember to use --no-readline.

targetting web with emscripten

$ git clone https://github.com/raysan5/raylib
$ cd raylib/src
$ make clean all PLATFORM=PLATFORM_WEB
$ ol-rl -o test.c test.scm
$ emcc -DPLATFORM_WEB -I/usr/local/include test.c /path/to/libraylib-web.a -o test.html -s USE_GLFW=3 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s ALLOW_MEMORY_GROWTH=1 -s ASYNCIFY -s ASSERTIONS=0

gotchas and caveats

TODOs

./raylib.scm: (raylib)

##false Exported values:

./raylib/common.scm: (raylib common)

##false Exported values:

./raylib/window.scm: (raylib window)

##false Exported values:

./raylib/util.scm: (raylib util)

##false Exported values:

./raylib/raymath.scm: (raylib raymath)

##false Exported values:

./raylib/const.scm: (raylib const)

##false Exported values:

./raylib/image.scm: (raylib image)

##false Exported values:

./raylib/audio.scm: (raylib audio)

##false Exported values:

./raylib/io.scm: (raylib io)

##false Exported values:

./raylib/draw.scm: (raylib draw)

##false Exported values: