diff --git a/examples/view.zig b/examples/view.zig index a067941..e31d7cf 100644 --- a/examples/view.zig +++ b/examples/view.zig @@ -125,8 +125,6 @@ pub fn main() !void { map_view = sm_map_view; } use_sm_map = !use_sm_map; - x = 0; - y = 0; w = map_width; h = map_height; } @@ -170,6 +168,7 @@ pub fn main() !void { // 2. A RenderConfig consisting of: // a. An x/y (col, row) position within the View as the start point of the render. // b. A Width and Height extending Right and Down from the start point that will represent the square being rendered. + // It also returns the calculated x/y position to help maintain scrolloing boundaries. x, y = try map_view.toWin( &map_win, if (!use_mini_view).{ diff --git a/src/View.zig b/src/View.zig index 1c6d395..8a0d03d 100644 --- a/src/View.zig +++ b/src/View.zig @@ -154,3 +154,8 @@ pub fn print(self: View, segments: []const Cell.Segment, opts: Window.PrintOptio pub fn printSegment(self: View, segment: Cell.Segment, opts: Window.PrintOptions) !Window.PrintResult { return self.print(&.{segment}, opts); } + +/// Create a child window +pub fn child(self: View, opts: Window.ChildOptions) Window { + return self.win.child(opts); +}