Provides full coverage of:
raylib.h
main cheatsheetraymath.h
math module
Includes:
- Built-in Raylib dynamic libraries for Windows and Linux (x64).
- Lume library
- 7 examples. Some of them are adaptations of official examples, the rest are custom ones.
- Makefile for both Windows and Linux
Bindings use kebab-case naming
(local rl (require :lib.raylib))
(local lume (require :lib.lume))
(print "epic")
(-> 4.5
(lume.round)
(print))
(rl.init-window 640 640 "Fennel & Raylib")
(rl.set-target-fps 60)
(local background (rl.Color 161 212 242 250))
(while (not (rl.window-should-close))
(rl.begin-drawing)
(rl.clear-background background)
(rl.end-drawing))
(rl.close-window)
(print "That's all")
You need to have Luajit and Fennel installed. The main bindings file which you want to import is raylib.fnl
.
- Luajit installation is very easy. Just follow the instructions Windows users read carefully the "Installing LuaJIT" section of the page: "Copy luajit.exe and lua51.dll (built in the src directory)..."
- Likewise with the Fennel (I install it via the script fennel-1.5.1 version)
fennel.bat script to run Fennel on Windows
@echo off
luajit C:\Games\Fennel\fennel1.5.1 %*
Just git clone
this repo, cd fnl-raylib
and then
fennel main.fnl
or
make run
or
fennel examples/core/core-input-keys.fnl
or (after make build
)
luajit main.lua
or
luajit examples/core/core-input-mouse.lua
you got it.
https://github.com/raysan5/raylib/tree/master/examples
https://github.com/raysan5/raylib/blob/1f0325b52c87af4820b31957d8e40d7bc1f112bb/src/raylib.h#L183
Prerequirements
- gcc compiler
- (if windows) LuaJIT installation into the
C:\
path. (When you installed luajit, you shouldgit clone
their repo from theC:\
folder)
Both C compiler and LuaJIT installation path could be tweaked and replaced by yourself!
So how to build an executable?
Run
make release
or if you want to do it manually:
- Compile Fennel to Lua
make build
- Compile Lua to Bytecode
luajit -b main.lua main.luac
- Create a C Wrapper and comile it
- Linux
gcc -o main main.c -lluajit-5.1
- Windows:
gcc -o main main.c -I"C:\LuaJIT\src" -L"C:\LuaJIT\src" -l"luajit-5.1"
- Run your executable! Test how it works
./main
- Package a release
Copy main
, main.luac
files and lib
folder into seperate directory (for example in release
)