diff --git a/main.zig b/main.zig index 6634ee1..7dd6f22 100644 --- a/main.zig +++ b/main.zig @@ -82,9 +82,9 @@ fn draw() !void { // mv_axis_border_bounce(w, &primitive.vec.b, 'x'); // mv_axis_border_bounce(w, &primitive.vec.b, 'y'); // mv_axis_border_bounce(w, &primitive.vec.c, 'x'); - // mv_axis_border_bounce(w, &primitive.vec.c, 'y'); + mv_axis_border_bounce(w, &polygon.head.?.point, 'Y'); try primitive.polygon_draw(buffer, w, &polygon); - try fill_draw(w, buffer); + // try fill_draw(w, buffer); try out.print("{s}", .{buffer}); sleep(30000000); diff --git a/movement.zig b/movement.zig index eceb23c..6c366a2 100644 --- a/movement.zig +++ b/movement.zig @@ -23,20 +23,20 @@ pub fn mv_axis_border_bounce(w: Winsize, point: *Point, axis: u8) void { cor = &point.x; upper = w.ws_col; dir = &point.direction.x; - dir.* = -1; + dir.* *= -1; }, 'Y' => { cor = &point.y; upper = w.ws_row; dir = &point.direction.y; - dir.* = -1; + dir.* *= -1; }, else => {}, } - if (cor.* < upper and cor.* > 0) { - cor.* += dir.*; - } + //if (cor.* < upper and cor.* > 0) { + cor.* += dir.*; + // } if (cor.* >= upper or cor.* <= 0) { dir.* *= -1; cor.* += dir.*;