From c51423874b9d230ac61ffd70dd2913bbfe06daea Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Fri, 13 Oct 2023 15:53:58 +0200 Subject: [PATCH] add raylib.zig as wrapper --- src/main.zig | 10 ++-------- src/raylib.zig | 5 +++++ 2 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 src/raylib.zig diff --git a/src/main.zig b/src/main.zig index d7091b6..253a226 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,11 +1,5 @@ const std = @import("std"); -const raylib = @cImport({ - @cInclude("raylib.h"); -}); -const raygui = @cImport({ - @cDefine("RAYGUI_IMPLEMENTATION", "1"); - @cInclude("raygui.h"); -}); +const raylib = @import("raylib.zig"); const sqlite = @cImport({ @cInclude("sqlite3.h"); }); @@ -21,7 +15,7 @@ pub fn main() !void { raylib.ClearBackground(raylib.RAYWHITE); raylib.DrawText("Congrats! You created your first window!", 190, 200, 20, raylib.LIGHTGRAY); - if (raygui.GuiButton(.{ .x = 0, .y = 0, .width = 100, .height = 100 }, "MyButton") == 1) {} + if (raylib.GuiButton(.{ .x = 0, .y = 0, .width = 100, .height = 100 }, "MyButton") == 1) {} } raylib.CloseWindow(); } diff --git a/src/raylib.zig b/src/raylib.zig new file mode 100644 index 0000000..e58a659 --- /dev/null +++ b/src/raylib.zig @@ -0,0 +1,5 @@ +pub usingnamespace @cImport({ + @cInclude("raylib.h"); + @cDefine("RAYGUI_IMPLEMENTATION", "1"); + @cInclude("raygui.h"); +});