Print key buffer on key event
This commit is contained in:
parent
ee93860c74
commit
a264206a67
@ -1 +1 @@
|
|||||||
Subproject commit 8e8a66761cb003b00ecc7a38307e83ddd33ffa27
|
Subproject commit d173dcc4da9b934a37ac13e7e11431984e25f70c
|
15
src/main.zig
15
src/main.zig
@ -226,6 +226,21 @@ fn handleKeyboard(win: mfb.Window(State), key: mfb.Key, _: mfb.KeyMod, is_presse
|
|||||||
var state = win.getUserData().?;
|
var state = win.getUserData().?;
|
||||||
state.*.paused = !state.*.paused;
|
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 {
|
fn handleCharInput(win: mfb.Window(State), char: u32) callconv(.C) void {
|
||||||
|
Loading…
Reference in New Issue
Block a user