diff --git a/lib/minifb b/lib/minifb index 2aabdba..8e8a667 160000 --- a/lib/minifb +++ b/lib/minifb @@ -1 +1 @@ -Subproject commit 2aabdbaee97ac946f01ea5828fffaa0d93cf4bd3 +Subproject commit 8e8a66761cb003b00ecc7a38307e83ddd33ffa27 diff --git a/src/main.zig b/src/main.zig index 4bf9be8..02fcdd2 100644 --- a/src/main.zig +++ b/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 {