Implemented setResizeCallback and setViewport

This commit is contained in:
2022-01-09 15:31:52 -07:00
parent 95daf52b70
commit ac2f09d9cf
2 changed files with 22 additions and 0 deletions

View File

@ -85,6 +85,15 @@ pub fn Window(comptime TUserData: type) type {
pub fn setActiveCallback(self: Window(TUserData), callback: ActiveFunc) void {
c.mfb_set_active_callback(self.cwin, @ptrCast(c.mfb_active_func, callback));
}
pub const ResizeFunc = fn (win: Window(TUserData), width: i32, height: i32) callconv(.C) void;
pub fn setResizeCallback(self: Window(TUserData), callback: ResizeFunc) void {
c.mfb_set_resize_callback(self.cwin, @ptrCast(c.mfb_resize_func, callback));
}
pub fn setViewport(self: Window(TUserData), offset_x: u32, offset_y: u32, width: u32, height: u32) bool {
return c.mfb_set_viewport(self.cwin, offset_x, offset_y, width, height);
}
};
}