From 036f2da55d7e89e2a2aa2a7c286de7d1476bc6e7 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Wed, 20 Aug 2025 14:29:14 +0200 Subject: [PATCH] Added raylib example --- examples/raylib/raylib.q | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 examples/raylib/raylib.q 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 -- 2.51.2