A lightweight game framework which melds SDL2 and the Wren scripting language, written in C.
Ensure you have the shared SDL2 libraries installed on your system first, then to build, run:
> make
Run ./dome [gamefile.wren] to run your game. If your initial file is called main.wren, just running ./dome will execute it.
Your game's entry point must contain a Game class which contains at least static init(), static update() and static draw(_) methods.
import "input" for Keyboard
import "graphics" for Canvas, Color
class Game {
static init() {
__x = 10
__y = 10
__w = 5
__h = 5
}
static update() {
if (Keyboard.isKeyDown("left")) {
__x = __x - 1
}
if (Keyboard.isKeyDown("right")) {
__x = __x+ 1
}
if (Keyboard.isKeyDown("up")) {
__y = __y - 1
}
if (Keyboard.isKeyDown("down")) {
__y = __y + 1
}
}
static draw(alpha) {
Canvas.cls()
var color = Color.rgb(171, 82, 54)
Canvas.rectfill(__x, __y, __w, __h, color)
}
}
DOME provides the following modules/methods/classes:
You can follow my progress on implementing DOME on my twitter.
DOME currently depends on a few libraries to achieve it's functions.
make automatically)make DOME_OPT_FFI=1)Apart from SDL2, all other dependancies are baked in or linked statically. DOME aspires to be both minimalist and cross platform, so it depends on as few external components as possible.