aboutsummaryrefslogtreecommitdiff
path: root/src/pointer.zig
diff options
context:
space:
mode:
authorJulien Dessaux2022-12-03 14:44:50 +0100
committerJulien Dessaux2022-12-03 15:07:57 +0100
commit0bf0375200d28e558f036103b9a19976f8d45872 (patch)
tree91dd1e3ddc0e3fa965e867e628eebdac42d78f2c /src/pointer.zig
parentFixed bugs from zig 0.10 upgrade (some real!) (diff)
downloadzigfunge98-0bf0375200d28e558f036103b9a19976f8d45872.tar.gz
zigfunge98-0bf0375200d28e558f036103b9a19976f8d45872.tar.bz2
zigfunge98-0bf0375200d28e558f036103b9a19976f8d45872.zip
Began writing a debugging tui
Diffstat (limited to 'src/pointer.zig')
-rw-r--r--src/pointer.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pointer.zig b/src/pointer.zig
index 0c516be..ce188f8 100644
--- a/src/pointer.zig
+++ b/src/pointer.zig
@@ -11,6 +11,8 @@ const pointerReturn = struct {
code: ?i64 = null,
};
+const PointerInfo = struct { x: i64, y: i64, dx: i64, dy: i64 };
+
pub const Pointer = struct {
allocator: std.mem.Allocator,
field: *field.Field,
@@ -350,6 +352,9 @@ pub const Pointer = struct {
self.step();
return result;
}
+ pub inline fn getInfo(self: *Pointer) PointerInfo {
+ return .{ .x = self.x, .y = self.y, .dx = self.dx, .dy = self.dy };
+ }
pub fn init(allocator: std.mem.Allocator, f: *field.Field, timestamp: ?i64, argv: []const []const u8, env: []const [*:0]const u8) !*Pointer {
var p = try allocator.create(Pointer);
errdefer allocator.destroy(p);