This is a simple binding for calling raylib functions within Gambit Scheme. Consider everything in this repository experimental, under heavy development, and subject to change.
It comes with a simply CMake-based language configuration for Gambit Scheme.
These are the tools you need to use the code in this repository:
- CMake
- make (or any build system you prefer, like Ninja, etc.)
- Gambit Scheme
- Optional: Raylib (if you want to use a system-wide installation instead of the submodule provided here)
Because I'm using Arch Linux, there's a bit of a naming conflict when installing Gambit Scheme. So the Gambit compiler gsc
is called gambitc
on my system. To avoid this problem, there are two options:
- If you already have Gambit Scheme compiler installed as
gsc
on your system, change all occurences ofgambitc
intogsc
in all files in thecmake
subdirectory. - If you build Gambit Scheme from source, use the
--enable-interpreter-name
and--enable-compiler-name
options during the configuration step to renamegsc
intogambitc
.
It's a bit annoying, but this will be fixed when I improve the CMake language definition (see #-)
This repository comes with raylib already integrated as a git submodule. This reflects my personal preferences, if you prefer to use CMake's FetchPackage
, it should be easy enough to modify the main CMakeLists.txt
to do that (I haven't tested it, though).
So start writing code, clone this repository and make sure all submodules are downloaded too:
git clone --recursive https://github.com/georgjz/raylib-gambit-scheme.git myschemegame
To build the example code found in src/main.scm
, just execute:
cd myschemegame
cmake -S . -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -B build
cmake --build build
./build/raylib-gambit-scheme
If you wish to change the name of the output binary, just edit line 8 of CMakeLists.txt
.
This should output the following window:
- In the build commands above, I explicitly tell CMake to use
gcc
; I have used bothgcc
andclang
successfully to build all code in this repository. But since Gambit Scheme itself is built withgcc
, I prefer to keep it consistent. I want to add an option to let users choose between compilers. - This code is not tested on Windows
and OSX. I have only tested this code as well as the CMake files on Arch Linux; cross-platform support is planned. It has also been successfully built on OSX. - The binding to raylib in
src/raylibbinding/raylib.scm
acts like a "single file header"; i.e., all functions of raylib are always bound. I plan to modify the CMake files to make sure only used functions/modules are actually bound (and built). I want this binding to follow the module design of raylib. - The Texture module is not working. The code is there, but I have commented it out, there are some bugs I need to fix (converting between different lengths of (pointers to)
int
s is the probable cause). - The variadic functions are not included. These are mostly small functions for tracing and text formatting.
Contributions are highly encouraged and welcomed! I'll probably need some help by porting to Windows and OSX; my experience on developing on these platforms is very limited.
Everything in this repository is released under the MIT License (see LICENSE
). For the raylib license, go here.