Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
zig-cache
.zig-cache
zig-out
imgui.ini
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Build things immediately with [Zig](https://www.ziglang.org), [Raylib](https://w

## Build

1. Install [Zig 0.13.0](https://ziglang.org/download/) for your platform.
1. Install [Zig 0.14.0](https://ziglang.org/download/) for your platform.
1. Clone this repo.
1. In the repo folder, run
- `zig build run` for Debug build.
Expand Down
4 changes: 2 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn build(b: *std.Build) !void {
});
exe.linkLibCpp();

const raylib_zig = b.dependency("raylib-zig", .{
const raylib_zig = b.dependency("raylib_zig", .{
.target = target,
.optimize = optimize,
});
Expand All @@ -28,7 +28,6 @@ pub fn build(b: *std.Build) !void {
});
exe.root_module.addImport("zgui", zgui.module("root"));
exe.linkLibrary(zgui.artifact("imgui"));
exe.addIncludePath(b.path("vendor/zgui/libs/imgui"));

const rlimgui = b.dependency("rlimgui", .{
.target = target,
Expand All @@ -44,6 +43,7 @@ pub fn build(b: *std.Build) !void {
},
});
exe.addIncludePath(rlimgui.path("."));
exe.addIncludePath(zgui.path("libs/imgui"));

b.installArtifact(exe);

Expand Down
25 changes: 17 additions & 8 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
.{
.name = "raylib-imgui-example",
.name = .raylib_imgui_example,
.version = "1.0.0",
.paths = .{ "src", "vendor" },
.fingerprint = 0xc76ef5a4fb435919, // Changing this has security and trust implications.
.minimum_zig_version = "0.14.0",
.dependencies = .{
.@"raylib-zig" = .{
.url = "https://github.com/Not-Nik/raylib-zig/archive/19db777449c0f56ca621121a00087d341eb77080.tar.gz",
.hash = "1220608d53a1e0e295f8367be3aa7b1439d044af1551ae64cf5ae6ce9edb05858e73",
.raylib_zig = .{
.url = "git+https://github.com/Not-Nik/raylib-zig?ref=devel#0de5f8aed0565f2dbd8bc6851499c85df9e73534",
.hash = "raylib_zig-5.6.0-dev-KE8REGMrBQCs5X69dptNzjw9Z7MYM1fgdaKrnuKf8zyr",
},
.rlimgui = .{
.url = "https://github.com/raylib-extras/rlImGui/archive/5930d542021a253ac7fef893d7e1536e86a632f8.tar.gz",
.hash = "1220d370be5b6aa21c78ba299c5ea91bfcfcc272ce7f0871646c9db2395beee39d89",
.url = "https://github.com/raylib-extras/rlImGui/archive/aba659ea01d7c641b9cb2613e5183077a2df1d5c.tar.gz",
.hash = "N-V-__8AAAzPXgCzS8V_d3vh0_F6Aa3GZtJ3iG-bU-c-1z9f",
},
.zgui = .{ .path = "vendor/zgui" },
.zgui = .{
.url = "git+https://github.com/zig-gamedev/zgui.git#0027c0117026df3b98102160bd1ecd476e5b80cc",
.hash = "zgui-0.6.0-dev--L6sZG-baAC_aKii9zSGNRzQGz4bdsEi2-SOjAtICP6k",
},
},
.paths = .{
"build.zig",
"build.zig.zon",
"src",
},
}
4 changes: 2 additions & 2 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub fn main() !void {
const zoom_delta = rl.getMouseWheelMove() * 0.01;
if (zoom_delta > 0 or (zoom_delta < 0 and camera.zoom > 0.05))
camera.zoom += zoom_delta;
if (rl.isMouseButtonDown(rl.MouseButton.mouse_button_left)) {
if (rl.isMouseButtonDown(rl.MouseButton.left)) {
const delta_x = mouse_position.x - prev_mouse_position.x;
const delta_y = mouse_position.y - prev_mouse_position.y;
camera.target = rl.Vector2{
Expand All @@ -122,7 +122,7 @@ pub fn main() !void {
};
for (strs, 2..) |str, i| {
const font_size = 24;
const text_size = rl.measureTextEx(rl.getFontDefault(), str, @floatFromInt(font_size), 1);
const text_size = rl.measureTextEx(try rl.getFontDefault(), str, @floatFromInt(font_size), 1);
const width: i32 = @divFloor(screen_width - @as(i32, @intFromFloat(text_size.x)), 2);
const height = screen_height - @as(i32, @intFromFloat(text_size.y)) * @as(i32, @intCast(i));
rl.drawText(str, width, height, font_size, rl.Color.red);
Expand Down
22 changes: 0 additions & 22 deletions vendor/zgui/LICENSE

This file was deleted.

201 changes: 0 additions & 201 deletions vendor/zgui/README.md

This file was deleted.

Loading