From 95daf52b70ceb08000087f64d69c2ea5cc693a1b Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Sun, 9 Jan 2022 12:28:45 -0700 Subject: [PATCH] Cleaned up user data debugging code --- src/main.zig | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/main.zig b/src/main.zig index 061fb22..c798de7 100644 --- a/src/main.zig +++ b/src/main.zig @@ -99,17 +99,10 @@ const Buffer = struct { }; fn handleActive(win: mfb.Window(State), isActive: bool) callconv(.C) void { - // win.getUserData().?.*.active = isActive; + win.getUserData().?.*.active = isActive; var data = win.getUserData(); - std.log.info("got data", .{}); if (data) |value| { - // value.*.active = isActive; - _ = value; - } - if (isActive) { - std.log.info("activated!!!!!!!!!!!!", .{}); - } else { - std.log.info("deactivated", .{}); + value.*.active = isActive; } } @@ -121,7 +114,7 @@ pub fn main() !void { defer state.deinit(); var win = mfb.Window(State).open("Hello minifb-zig", Width, Height, .{ .resizable = true, .alwaysOnTop = true }) catch unreachable; - mfb.setTargetFPS(7); + mfb.setTargetFPS(30); win.setUserData(&state); win.setActiveCallback(handleActive); @@ -129,11 +122,6 @@ pub fn main() !void { var buf = try Buffer.init(alloc, Width, Height); defer buf.deinit(); - var aliasedState = win.getUserData(); - if (aliasedState) |value| { - std.log.info("Period: {d}", .{value.*.period}); - } - state.render(buf); while (win.waitSync()) { state.render(buf);