From 381db25621dc300cb872c1646399ef2953d39d24 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Wed, 4 Oct 2023 14:20:49 +0200 Subject: [PATCH] add raygui --- .gitmodules | 3 +++ zig/3rd-party/raygui | 1 + zig/build.zig | 1 + zig/src/main.zig | 5 +++++ 4 files changed, 10 insertions(+) create mode 160000 zig/3rd-party/raygui diff --git a/.gitmodules b/.gitmodules index 32be516..ec6a971 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "zig/3rd-party/raylib"] path = zig/3rd-party/raylib url = https://github.com/raysan5/raylib/ +[submodule "zig/3rd-party/raygui"] + path = zig/3rd-party/raygui + url = https://github.com/raysan5/raygui/ diff --git a/zig/3rd-party/raygui b/zig/3rd-party/raygui new file mode 160000 index 0000000..85a5c10 --- /dev/null +++ b/zig/3rd-party/raygui @@ -0,0 +1 @@ +Subproject commit 85a5c104f509b183c8cc7db0d90c2ab7a2b198c8 diff --git a/zig/build.zig b/zig/build.zig index 047fe53..61a094f 100644 --- a/zig/build.zig +++ b/zig/build.zig @@ -20,6 +20,7 @@ pub fn build(b: *std.Build) void { .target = target, .optimize = optimize, }); + exe.addIncludePath(.{ .path = "3rd-party/raygui/src" }); exe.linkLibrary(raylib_dep.artifact("raylib")); // This declares intent for the executable to be installed into the diff --git a/zig/src/main.zig b/zig/src/main.zig index d9cff41..31da555 100644 --- a/zig/src/main.zig +++ b/zig/src/main.zig @@ -2,6 +2,10 @@ const std = @import("std"); const raylib = @cImport({ @cInclude("raylib.h"); }); +const raygui = @cImport({ + @cDefine("RAYGUI_IMPLEMENTATION", "1"); + @cInclude("raygui.h"); +}); pub fn main() !void { const screen_width = 800; @@ -14,6 +18,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) {} } raylib.CloseWindow(); }