Created
January 11, 2024 22:31
-
-
Save guidoschmidt/09fdb6cd12aac7e99bce0bbc9871a833 to your computer and use it in GitHub Desktop.
Revisions
-
guidoschmidt created this gist
Jan 11, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ fn printDefault(c: u8) void { std.debug.print("{c}", .{ c }); } fn animate(buffer: *[]u8, rows: u32, cols: u32, comptime print_fn: fn(u8) void) void { for(0..rows) |dy| { for(0..cols) |dx| { const idx = dy * cols + dx; const pipe_tile = buffer.*[idx]; std.debug.print("\x1B[{d};{d}H", .{ dy, dx }); print_fn(pipe_tile); } } std.time.sleep(1000 * 1000 * 16); }