fix: alpha rendering of buttons and palettes

This commit is contained in:
CJ van den Berg 2024-11-04 23:04:05 +01:00
parent 9421f4e7f6
commit 4e1796df27
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
5 changed files with 46 additions and 10 deletions

View file

@ -114,6 +114,19 @@ pub fn home(self: *Plane) void {
self.col = 0;
}
pub fn fill_width(self: *Plane, comptime fmt: anytype, args: anytype) !usize {
var buf: [fmt.len + 4096]u8 = undefined;
var pos: usize = 0;
const width = self.window.width;
var text_width: usize = 0;
while (text_width < width) {
const text = try std.fmt.bufPrint(buf[pos..], fmt, args);
pos += text.len;
text_width += self.egc_chunk_width(text, 0, 8);
}
return self.putstr(buf[0..pos]);
}
pub fn print(self: *Plane, comptime fmt: anytype, args: anytype) !usize {
var buf: [fmt.len + 4096]u8 = undefined;
const text = try std.fmt.bufPrint(&buf, fmt, args);