raylib example

This commit is contained in:
2025-11-11 13:33:40 +01:00
parent ca8ae6e110
commit 46045af4fa
3 changed files with 54 additions and 10 deletions

20
examples/raylib.zr Normal file
View File

@@ -0,0 +1,20 @@
// musl doesnt like dlopen, needs to be compiled with -m
func main[] : I64
let rl: Ptr = c.dlopen("libraylib.so", 2)
let rl.InitWindow: Ptr = c.dlsym(rl, "InitWindow")
let rl.WindowShouldClose: Ptr = c.dlsym(rl, "WindowShouldClose")
let rl.BeginDrawing: Ptr = c.dlsym(rl, "BeginDrawing")
let rl.EndDrawing: Ptr = c.dlsym(rl, "EndDrawing")
let rl.ClearBackground: Ptr = c.dlsym(rl, "ClearBackground")
let rl.CloseWindow: Ptr = c.dlsym(rl, "CloseWindow")
rl.InitWindow(800, 600, "Hello, World!")
while !rl.WindowShouldClose()
rl.BeginDrawing()
rl.ClearBackground(4278190335) // 0xff0000ff
rl.EndDrawing()
rl.CloseWindow()