diff --git a/src/tui/Box.zig b/src/tui/Box.zig index cb31862..c11b441 100644 --- a/src/tui/Box.zig +++ b/src/tui/Box.zig @@ -1,4 +1,5 @@ const Plane = @import("renderer").Plane; +const Layer = @import("renderer").Layer; const Self = @This(); @@ -35,6 +36,15 @@ pub fn from(n: Plane) Self { }; } +pub fn to_layer(self: Self) Layer.Options { + return .{ + .y = @intCast(self.y), + .x = @intCast(self.x), + .h = @intCast(self.h), + .w = @intCast(self.w), + }; +} + pub fn is_abs_coord_inside(self: Self, y: usize, x: usize) bool { return y >= self.y and y < self.y + self.h and x >= self.x and x < self.x + self.w; }