diff --git a/lib/minifb b/lib/minifb index 8e8a667..d173dcc 160000 --- a/lib/minifb +++ b/lib/minifb @@ -1 +1 @@ -Subproject commit 8e8a66761cb003b00ecc7a38307e83ddd33ffa27 +Subproject commit d173dcc4da9b934a37ac13e7e11431984e25f70c diff --git a/src/main.zig b/src/main.zig index 02fcdd2..f7a13ac 100644 --- a/src/main.zig +++ b/src/main.zig @@ -226,6 +226,21 @@ fn handleKeyboard(win: mfb.Window(State), key: mfb.Key, _: mfb.KeyMod, is_presse var state = win.getUserData().?; state.*.paused = !state.*.paused; } + + const out = std.io.getStdOut().writer(); + var has_written = false; + for (win.getKeyBuffer()) |buf_key, i| { + if (buf_key) { + if (!has_written) { + _ = out.write("Keyboard buffer:") catch unreachable; + } + std.fmt.format(out, " {}", .{@intToEnum(mfb.Key, i)}) catch unreachable; + has_written = true; + } + } + if (has_written) { + out.writeByte('\n') catch unreachable; + } } fn handleCharInput(win: mfb.Window(State), char: u32) callconv(.C) void {