summaryrefslogtreecommitdiff
path: root/examples/graphics/raylib_demo.zc
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-17 12:14:26 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-17 12:14:26 +0000
commitd15dbaf025df9265dce417faaa5ccf33ae04d4b5 (patch)
tree57201674789a305c0bc7b82632fa906534dbf37d /examples/graphics/raylib_demo.zc
parent91e763a600afc86e9630e4db592d8108f65def16 (diff)
Fix for #31
Diffstat (limited to 'examples/graphics/raylib_demo.zc')
-rw-r--r--examples/graphics/raylib_demo.zc40
1 files changed, 40 insertions, 0 deletions
diff --git a/examples/graphics/raylib_demo.zc b/examples/graphics/raylib_demo.zc
new file mode 100644
index 0000000..77b661e
--- /dev/null
+++ b/examples/graphics/raylib_demo.zc
@@ -0,0 +1,40 @@
+//> link: -lraylib -lm
+
+import "raylib.h" as raylib;
+
+fn main() {
+ raylib::InitWindow(800, 600, "Zen C + Raylib");
+ defer raylib::CloseWindow();
+
+ raylib::SetTargetFPS(60);
+
+ var x = 400;
+ var y = 300;
+ var dx = 5;
+ var dy = 4;
+ var radius = 30;
+
+ while !raylib::WindowShouldClose()
+ {
+ x += dx;
+ y += dy;
+
+ if x - radius < 0 || x + radius > 800 {
+ dx = -dx;
+ }
+ if y - radius < 0 || y + radius > 600 {
+ dy = -dy;
+ }
+
+ raylib::BeginDrawing();
+ raylib::ClearBackground(RAYWHITE);
+
+ raylib::DrawText("Zen C + Raylib Demo!", 250, 20, 30, DARKGRAY);
+
+ raylib::DrawCircle(x, y, (float)radius, RED);
+
+ raylib::DrawFPS(10, 10);
+
+ raylib::EndDrawing();
+ }
+}