-
Notifications
You must be signed in to change notification settings - Fork 1
/
raylib.sy
51 lines (40 loc) · 1.52 KB
/
raylib.sy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
ffi = import("ffi")
raylib_dll_path = "libraylib." + ffi.dll.suffix
raylib = ffi.dll.open(raylib_dll_path, {
# RLAPI void InitWindow(int width, int height, const char *title); // Initialize window and OpenGL context
"InitWindow": {
"parameters": [ffi.types.i32, ffi.types.i32, ffi.types.pointer],
"returns": ffi.types.void,
},
# RLAPI bool WindowShouldClose(void); // Check if application should close (KEY_ESCAPE pressed or windows close icon clicked)
"WindowShouldClose": {
"parameters": [],
"returns": ffi.types.i8,
},
# RLAPI void CloseWindow(void); // Close window and unload OpenGL context
"CloseWindow": {
"parameters": [],
"returns": ffi.types.void,
},
# RLAPI void BeginDrawing(void); // Setup canvas (framebuffer) to start drawing
"BeginDrawing": {
"parameters": [],
"returns": ffi.types.void,
},
# RLAPI void EndDrawing(void); // End canvas drawing and swap buffers (double buffering)
"EndDrawing": {
"parameters": [],
"returns": ffi.types.void,
},
})
if raylib == none {
println(raylib_dll_path + ": failed to open dynamic link library")
exit(1)
}
raylib.InitWindow(800, 600, ffi.to_cstring("Some Blank Example"))
while !raylib.WindowShouldClose() {
raylib.BeginDrawing()
raylib.EndDrawing()
}
raylib.CloseWindow()
ffi.dll.close(raylib)