fix utf8 encoding background
This commit is contained in:
parent
448e309c04
commit
60ae492b0f
16
main.zig
16
main.zig
@ -126,7 +126,10 @@ fn fillBuffer() !void {
|
|||||||
|
|
||||||
var w = Winsize{};
|
var w = Winsize{};
|
||||||
var i: u64 = 0;
|
var i: u64 = 0;
|
||||||
|
var ii: u64 = 0;
|
||||||
var buf = std.mem.zeroes([2]u8);
|
var buf = std.mem.zeroes([2]u8);
|
||||||
|
var slice: []u8 = undefined;
|
||||||
|
var bytes_written: u3 = 0;
|
||||||
|
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
w = try getTermDimension();
|
w = try getTermDimension();
|
||||||
@ -147,15 +150,18 @@ fn fillBuffer() !void {
|
|||||||
.c = Point{ .x = 30, .y = 1, .z = 0, .direction = .{ .x = 1, .y = 1, .z = 1 } },
|
.c = Point{ .x = 30, .y = 1, .z = 0, .direction = .{ .x = 1, .y = 1, .z = 1 } },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//clear buffer
|
||||||
while (true) {
|
while (true) {
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < buffer.len) : (i += 4) {
|
while (i < buffer.len) : (i += 4) {
|
||||||
const slice = buffer[i .. i + 4];
|
slice = buffer[i .. i + 4];
|
||||||
_ = try std.unicode.utf8Encode('_', slice);
|
bytes_written = try std.unicode.utf8Encode(' ', slice);
|
||||||
//slice[0] = 'm';
|
ii = 0;
|
||||||
|
while ((bytes_written + ii) < 4) : (ii += 1) {
|
||||||
|
slice[bytes_written + ii] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try pixel(buffer, w, 5, 10, '\u{1F702}');
|
|
||||||
try triangle(buffer, w, vec);
|
try triangle(buffer, w, vec);
|
||||||
//_ = try bresenham(buffer, w, Point{ .x = 10, .y = 10, .z = 0 }, Point{ .x = 30, .y = 12, .z = 0 });
|
//_ = try bresenham(buffer, w, Point{ .x = 10, .y = 10, .z = 0 }, Point{ .x = 30, .y = 12, .z = 0 });
|
||||||
|
|
||||||
@ -179,7 +185,7 @@ fn fillBuffer() !void {
|
|||||||
bounce(w, &vec2.c, 'x');
|
bounce(w, &vec2.c, 'x');
|
||||||
bounce(w, &vec2.c, 'y');
|
bounce(w, &vec2.c, 'y');
|
||||||
try out.print("{s}", .{buffer});
|
try out.print("{s}", .{buffer});
|
||||||
sleep(1000000);
|
sleep(10000000);
|
||||||
//_ = try stdin.readUntilDelimiterOrEof(&buf, '\n');
|
//_ = try stdin.readUntilDelimiterOrEof(&buf, '\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user