diff options
author | Julien Dessaux | 2022-12-03 14:44:50 +0100 |
---|---|---|
committer | Julien Dessaux | 2022-12-03 15:07:57 +0100 |
commit | 0bf0375200d28e558f036103b9a19976f8d45872 (patch) | |
tree | 91dd1e3ddc0e3fa965e867e628eebdac42d78f2c /src/field.zig | |
parent | Fixed bugs from zig 0.10 upgrade (some real!) (diff) | |
download | zigfunge98-0bf0375200d28e558f036103b9a19976f8d45872.tar.gz zigfunge98-0bf0375200d28e558f036103b9a19976f8d45872.tar.bz2 zigfunge98-0bf0375200d28e558f036103b9a19976f8d45872.zip |
Began writing a debugging tui
Diffstat (limited to '')
-rw-r--r-- | src/field.zig | 9 |
1 files changed, 9 insertions, 0 deletions
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) }; } |