implement polygon

a bug in the fill algorythm where it fills every
This commit is contained in:
jonathan santis
2024-11-01 13:21:20 +01:00
parent e91c744c16
commit ece4540426
2 changed files with 24 additions and 2 deletions

View File

@@ -106,6 +106,19 @@ test "test linked list" {
}
std.debug.print("next:{}\n", .{polygon.next()});
std.debug.print("next:{}\n", .{polygon.next()});
std.debug.print("typeof:{}\n", .{@TypeOf(polygon)});
}
pub fn polygon_draw(buf: []u8, w: Winsize, poly: *LinkedList()) !void {
var i: u8 = 0;
var previous: Point = poly.next();
var current: Point = undefined;
while (i < poly.length) : (i += 1) {
current = poly.next();
try bresenham(buf, w, previous, current);
previous = current;
}
}
pub fn pixel(buffer: []u8, w: Winsize, x: i64, y: i64, symbol: u21) !void {