Print mouse button buffer on mouse button event
This commit is contained in:
parent
d742a5f51c
commit
ee93860c74
@ -1 +1 @@
|
||||
Subproject commit 2aabdbaee97ac946f01ea5828fffaa0d93cf4bd3
|
||||
Subproject commit 8e8a66761cb003b00ecc7a38307e83ddd33ffa27
|
10
src/main.zig
10
src/main.zig
@ -180,9 +180,17 @@ fn handleResize(win: mfb.Window(State), width: i32, height: i32) callconv(.C) vo
|
||||
}
|
||||
}
|
||||
|
||||
fn handleMouseButton(_: mfb.Window(State), mouse_button: mfb.MouseButton, key_mod: mfb.KeyMod, is_pressed: bool) callconv(.C) void {
|
||||
fn handleMouseButton(win: mfb.Window(State), mouse_button: mfb.MouseButton, key_mod: mfb.KeyMod, is_pressed: bool) callconv(.C) void {
|
||||
const up_down: []const u8 = if (is_pressed) "down" else "up";
|
||||
std.log.info("{any} mouse{d} {s}", .{ key_mod, @enumToInt(mouse_button), up_down });
|
||||
|
||||
var buf_string = [_]u8{'.', ' ', '.', ' ', '.', ' ', '.', ' ', '.', ' ', '.', ' ', '.', ' ', '.'};
|
||||
for (win.getMouseButtonBuffer().*) |button, i| {
|
||||
if (button) {
|
||||
buf_string[i * 2] = '*';
|
||||
}
|
||||
}
|
||||
std.log.info("Mouse button buffer: {s}", .{&buf_string});
|
||||
}
|
||||
|
||||
fn handleMouseMove(win: mfb.Window(State), x: i32, y: i32) callconv(.C) void {
|
||||
|
Loading…
Reference in New Issue
Block a user