libvaxis/src/widgets/alignment.zig

8 lines
295 B
Zig
Raw Normal View History

const Window = @import("../Window.zig");
pub fn center(parent: Window, cols: usize, rows: usize) Window {
const y_off = (parent.height / 2) - (rows / 2);
const x_off = (parent.width / 2) - (cols / 2);
return parent.initChild(x_off, y_off, .{ .limit = cols }, .{ .limit = rows });
}