use raygui

zig
Fabien Freling 2022-03-24 13:25:40 +01:00
parent 82b49f65c2
commit f5f6cf81b4
3 changed files with 12 additions and 6 deletions

2
3rdparty/raylib vendored

@ -1 +1 @@
Subproject commit 0851960397f02a477d80eda2239f90fae14dec64
Subproject commit ca12ef48e9e9f4eae03b1ca43ec3eb0a78d63dd3

View File

@ -14,8 +14,8 @@ pub fn build(b: *std.build.Builder) void {
const exe = b.addExecutable("doggo", "src/main.zig");
exe.setTarget(target);
const ray = raylib.Pkg("./3rdparty/raylib/src").addRaylib(b, exe.target);
const ray = raylib.addRaylib(b, exe.target);
exe.linkLibrary(ray);
exe.addIncludeDir("./3rdparty/raylib/src");

View File

@ -2,6 +2,10 @@ const std = @import("std");
const ray = @cImport({
@cInclude("raylib.h");
});
const raygui = @cImport({
@cDefine("RAYGUI_IMPLEMENTATION", {});
@cInclude("extras/raygui.h");
});
pub fn main() anyerror!void {
std.log.info("All your codebase are belong to us.", .{});
@ -9,15 +13,17 @@ pub fn main() anyerror!void {
ray.InitWindow(800, 450, "ray [core] example - basic window");
defer ray.CloseWindow();
while (!ray.WindowShouldClose())
{
while (!ray.WindowShouldClose()) {
ray.BeginDrawing();
defer ray.EndDrawing();
ray.ClearBackground(ray.RAYWHITE);
ray.DrawText("Congrats! You created your first window!", 190, 200, 20, ray.LIGHTGRAY);
}
if (raygui.GuiButton(raygui.Rectangle{ .x = 190, .y = 250, .width = 150, .height = 30 }, "Button")) {
std.log.info("Button pressed", .{});
}
}
}
test "basic test" {