Cleaned up user data debugging code
This commit is contained in:
parent
c12c0ea0fb
commit
95daf52b70
18
src/main.zig
18
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);
|
||||
|
Loading…
Reference in New Issue
Block a user