Skip to content

Commit e792b9f

Browse files
committed
Add zgui game launch button
1 parent cd7aab8 commit e792b9f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main.zig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ const zglfw = @import("zglfw");
66
const zgpu = @import("zgpu");
77
const zgui = @import("zgui");
88

9+
const ConverterErrors = error{
10+
WeirdGameDir,
11+
};
12+
913
pub fn main() !void {
1014
zglfw.init() catch {
1115
std.log.err("Failed to initialize GLFW library.", .{});
@@ -105,6 +109,13 @@ pub fn main() !void {
105109

106110
std.debug.print("Done converting!\n", .{});
107111
}
112+
if (zgui.button("Launch", .{ .w = 200.0 })) {
113+
const path = "I:/Programming/Cortex-Command-Community-Project-Data/Cortex Command.debug.release.exe";
114+
try std.os.chdir(std.fs.path.dirname(path) orelse return ConverterErrors.WeirdGameDir);
115+
var argv = [_][]const u8{path};
116+
const result = try std.ChildProcess.exec(.{ .argv = &argv, .allocator = gpa });
117+
_ = result;
118+
}
108119
}
109120
zgui.end();
110121

0 commit comments

Comments
 (0)