From ca3fd842c3edd17a922b041e05471875adc64c44 Mon Sep 17 00:00:00 2001 From: Nic Gaffney Date: Mon, 9 Sep 2024 06:24:13 -0500 Subject: perf: Multithreading and resizable window --- src/imgui.zig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/imgui.zig') diff --git a/src/imgui.zig b/src/imgui.zig index 163ee0f..0796cdb 100644 --- a/src/imgui.zig +++ b/src/imgui.zig @@ -24,8 +24,8 @@ pub fn update(alloc: std.mem.Allocator, buf: [:0]u8) !void { cfg.minDistance = 20.0; } _ = z.sliderInt("Particles", .{ .v = &cfg.particleCount, .min = 1, .max = cfg.particleMax }); - _ = z.sliderFloat("Radius", .{ .v = &cfg.radius, .min = 1, .max = 500 }); - _ = z.sliderFloat("Minimum Distance", .{ .v = &cfg.minDistance, .min = 1.0, .max = 100.0 }); + _ = z.sliderFloat("Radius", .{ .v = &cfg.radius, .min = cfg.minDistance, .max = 500 }); + _ = z.sliderFloat("Minimum Distance", .{ .v = &cfg.minDistance, .min = 1.0, .max = cfg.radius }); } if (z.collapsingHeader("Ruleset", .{ .default_open = true })) { _ = z.beginTable("Rules", .{ @@ -34,7 +34,6 @@ pub fn update(alloc: std.mem.Allocator, buf: [:0]u8) !void { .outer_size = .{ 0, 0 }, .inner_width = 0, }); - defer z.endTable(); _ = z.tableNextRow(.{}); _ = z.tableSetColumnIndex(0); z.text("Rules", .{}); @@ -58,6 +57,9 @@ pub fn update(alloc: std.mem.Allocator, buf: [:0]u8) !void { _ = z.popItemWidth(); } } + z.endTable(); + if (z.button("Randomize", .{})) + cfg.rules = rul.ruleMatrix(); } if (z.collapsingHeader("Load / Save", .{ .default_open = true })) { _ = z.inputText("Save Path", .{ .buf = buf }); -- cgit v1.2.3