From d6a9a2a2499600cbdfc1a0d8b749808f4ea5fcb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Hu=E1=BB=B3nh=20Anh=20Khoa?= <113995598+anhkhoakz@users.noreply.github.com> Date: Tue, 10 Jun 2025 14:37:02 +0700 Subject: [PATCH 1/3] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8d59836..e5ee10c 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ Start your favorite terminal, maximize it, then launch DOOM-fire-zig! Test your | VS Code | great | great | poor (20fps) | | Warp | great? | great | - | | WezTerm | ? | ? | ok | +| Ghostty | ? | great | - | ### Definitions ``` From bc247d3cc7ef4b05f4918044d2ab417dd64cb54c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=92riks=20Remess?= Date: Fri, 27 Feb 2026 03:02:28 +0200 Subject: [PATCH 2/3] Zig 0.15.2 support --- .zigversion | 2 +- README.md | 3 +-- build.tst | 10 ++++++---- build.zig | 8 +++++--- build.zig.zon | 2 +- src/main.zig | 37 ++++++++++++++++++++----------------- 6 files changed, 34 insertions(+), 28 deletions(-) diff --git a/.zigversion b/.zigversion index c64601b..4312e0d 100644 --- a/.zigversion +++ b/.zigversion @@ -1 +1 @@ -0.14 \ No newline at end of file +0.15.2 diff --git a/README.md b/README.md index e5ee10c..939b8d5 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Build Requirements: * windows - kernel32 Merge Request (MR) Validation: -* Each MR tested on MacOS Sequia 15.3 / M1 w/zig 0.14 on MacOS Kitty, VS Code, Alacritty. +* Each MR tested on MacOS Sequia 15.3 / M1 w/zig 0.15.2 on MacOS Kitty, VS Code, Alacritty. * Many MR tested on Windows 10 / Intel, with Microsoft Terminal, CMD.EXE, PowerShell. * Linux tests are c/o the wonderful community who help identify...and repair...cross platform issues! @@ -144,4 +144,3 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/. - diff --git a/build.tst b/build.tst index c777934..34158d8 100644 --- a/build.tst +++ b/build.tst @@ -13,9 +13,11 @@ pub fn build(b: *std.Build) void { const exe = b.addExecutable(.{ .name = "DOOM-fire", - .root_source_file = b.path("src/main.zig"), - .target = target, - .optimize = optimize, + .root_module = b.createModule(.{ + .root_source_file = b.path("src/main.zig"), + .target = target, + .optimize = optimize, + }), }); exe.linkLibC(); @@ -30,7 +32,7 @@ pub fn build(b: *std.Build) void { const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); - const exe_tests = b.addTest(.{ .name = "exe_tests", .root_source_file = b.path("src/main.zig"), .target = target }); + const exe_tests = b.addTest(.{ .name = "exe_tests", .root_module = exe.root_module }); const test_step = b.step("test", "Run unit tests"); test_step.dependOn(&exe_tests.step); diff --git a/build.zig b/build.zig index 34a4771..d19c477 100644 --- a/build.zig +++ b/build.zig @@ -17,9 +17,11 @@ pub fn build(b: *std.Build) void { const exe = b.addExecutable(.{ .name = "DOOM-fire", - .root_source_file = b.path("src/main.zig"), - .target = target, - .optimize = optimize, + .root_module = b.createModule(.{ + .root_source_file = b.path("src/main.zig"), + .target = target, + .optimize = optimize, + }), }); //libc linking diff --git a/build.zig.zon b/build.zig.zon index 1c7ad06..03bd09e 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -28,7 +28,7 @@ // Tracks the earliest Zig version that the package considers to be a // supported use case. - .minimum_zig_version = "0.14.0", + .minimum_zig_version = "0.15.2", // This field is optional. // Each dependency must either provide a `url` and `hash`, or a `path`. diff --git a/src/main.zig b/src/main.zig index cceca94..66e34a6 100644 --- a/src/main.zig +++ b/src/main.zig @@ -8,8 +8,8 @@ const std = @import("std"); const allocator = std.heap.page_allocator; -var stdout: std.fs.File.Writer = undefined; -var stdin: std.fs.File.Reader = undefined; +var stdout: std.fs.File = undefined; +var stdin: std.fs.File = undefined; var g_tty_win: win32.HANDLE = undefined; /////////////////////////////////// @@ -117,10 +117,14 @@ pub fn emit(s: []const u8) !void { } return; } else { - const sz = try stdout.write(s); - if (sz == 0) { - return; - } // cauze I c + var written: usize = 0; + while (written < s.len) { + const sz = try stdout.write(s[written..]); + if (sz == 0) { + return; + } + written += sz; + } return; } } @@ -231,7 +235,7 @@ pub fn getTermSzLinux() !TermSz { //Linux-MacOS Case //base case - invoked from cmd line - const tty_nix = stdout.context.handle; + const tty_nix = stdout.handle; var winsz = std.c.winsize{ .col = 0, .row = 0, .xpixel = 0, .ypixel = 0 }; const rv = std.c.ioctl(tty_nix, TIOCGWINSZ, @intFromPtr(&winsz)); const err = std.posix.errno(rv); @@ -338,10 +342,9 @@ pub fn pause() !void { try emit(color_reset); try emit("Press return to continue..."); - var b: u8 = undefined; - b = stdin.readByte() catch undefined; - - if (b == 'q') { + var b: [1]u8 = undefined; + const bytes_read = stdin.read(&b) catch 0; + if (bytes_read == 1 and b[0] == 'q') { //exit cleanly try complete(); std.process.exit(0); @@ -576,11 +579,11 @@ pub fn scrollMarquee() !void { try emit(line_clear_to_eol); try emit(nl); - std.time.sleep(10 * std.time.ns_per_ms); + std.Thread.sleep(10 * std.time.ns_per_ms); } //let quote chill for a second - std.time.sleep(1000 * std.time.ns_per_ms); + std.Thread.sleep(1000 * std.time.ns_per_ms); //fade out fade_idx = fade_len - 1; @@ -598,7 +601,7 @@ pub fn scrollMarquee() !void { try emit(txt[txt_idx * 2 + 1]); try emit(line_clear_to_eol); try emit(nl); - std.time.sleep(10 * std.time.ns_per_ms); + std.Thread.sleep(10 * std.time.ns_per_ms); } try emit(nl); } @@ -689,7 +692,7 @@ pub fn paintBuf() !void { fps = @as(f64, @floatFromInt(bs_frame_tic)) / t_dur; try emit(fg[0]); - try emitFmt("mem: {s:.2} min / {s:.2} avg / {s:.2} max [ {d:.2} fps ]", .{ std.fmt.fmtIntSizeBin(bs_sz_min), std.fmt.fmtIntSizeBin(bs_sz_avg), std.fmt.fmtIntSizeBin(bs_sz_max), fps }); + try emitFmt("mem: {Bi:.2} min / {Bi:.2} avg / {Bi:.2} max [ {d:.2} fps ]", .{ bs_sz_min, bs_sz_avg, bs_sz_max, fps }); } // initBuf(); defer freeBuf(); @@ -835,8 +838,8 @@ pub fn showDoomFire() !void { /////////////////////////////////// pub fn main() anyerror!void { - stdout = std.io.getStdOut().writer(); - stdin = std.io.getStdIn().reader(); + stdout = std.fs.File.stdout(); + stdin = std.fs.File.stdin(); try initTerm(); defer complete() catch {}; From 7912b4d185fa85f4f34c3daf94adefc547cf869f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=92riks=20Remess?= Date: Fri, 27 Feb 2026 03:07:38 +0200 Subject: [PATCH 3/3] fix: update Ghostty performance rating in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 939b8d5..c487d8d 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Start your favorite terminal, maximize it, then launch DOOM-fire-zig! Test your | VS Code | great | great | poor (20fps) | | Warp | great? | great | - | | WezTerm | ? | ? | ok | -| Ghostty | ? | great | - | +| Ghostty | great | great | - | ### Definitions ```