From 0bf0375200d28e558f036103b9a19976f8d45872 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sat, 3 Dec 2022 14:44:50 +0100 Subject: Began writing a debugging tui --- src/field.zig | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/field.zig') diff --git a/src/field.zig b/src/field.zig index 0130848..03f9da3 100644 --- a/src/field.zig +++ b/src/field.zig @@ -69,6 +69,12 @@ const Line = struct { if (x >= l.x and x < l.x + @intCast(i64, l.len())) return l.data.items[@intCast(usize, x - @intCast(i64, l.x))]; return ' '; } + pub inline fn getData(l: *Line) std.ArrayList(i64) { + return l.data; + } + pub inline fn getX(l: *Line) i64 { + return l.x; + } fn init(allocator: std.mem.Allocator) !*Line { var l = try allocator.create(Line); l.allocator = allocator; @@ -244,6 +250,9 @@ pub const Field = struct { if (y >= f.y and y < f.y + @intCast(i64, f.lines.items.len)) return f.lines.items[@intCast(usize, y - @intCast(i64, f.y))].get(x); return ' '; } + pub fn getLine(f: *Field, y: usize) *Line { + return f.lines.items[y]; + } pub fn getSize(f: Field) [4]i64 { return [4]i64{ f.x, f.y, @intCast(i64, f.lx), @intCast(i64, f.lines.items.len) }; } -- cgit v1.2.3