diff --git a/examples/raylib/raylib.q b/examples/raylib/raylib.q new file mode 100644 index 0000000..1c584b9 --- /dev/null +++ b/examples/raylib/raylib.q @@ -0,0 +1,35 @@ +// This example is currently Windows only and it +// needs the raylib.dll file next to the executable. +// It creates an empty window. +// +// NOTE: +// - the `float` data type is not implemented yet +// - passing structs by value to extern calls is not implemented yet + +main() { + raylib.InitWindow(1280, 720, "raylib example\0".ptr) + monitor := raylib.GetCurrentMonitor() + fps := raylib.GetMonitorRefreshRate(monitor) + raylib.SetTargetFPS(fps) + + loop { + if raylib.WindowShouldClose() { + return + } + + raylib.BeginDrawing() + raylib.EndDrawing() + } +} + +extern { + raylib { + BeginDrawing() + EndDrawing() + GetCurrentMonitor() -> int + GetMonitorRefreshRate(monitor int) -> int + InitWindow(width int, height int, title *byte) + SetTargetFPS(fps int) + WindowShouldClose() -> bool + } +} \ No newline at end of file