get some more stuff working

This commit is contained in:
2026-04-20 20:35:40 -05:00
parent e8fc65fcd8
commit ddbe1ea7a6
7 changed files with 54 additions and 23 deletions
+24 -15
View File
@@ -13,26 +13,28 @@ const Style = grome.view.style.Style;
pub const Nucleus = struct {
location: Point,
style_loop_ctr: usize,
widget: Widget,
const healthy_loop = [_]Style{
"\x1b[92m[1] \x1b[0m", // 92 - bright green
"\x1b[10106m[2] \x1b[0m", // 256 color 10106 (85)
"\x1b[38;2;56;142;60m[3] \x1b[0m", // RGB(56,142,60)
"\x1b[32m[4] \x1b[0m", // standard green (92)
"\x1b[39m[5] \x1b[0m", // even lighter
"\x1b[35m[6] \x1b[0m", // medium green (64)
.{ .escape = },
.{ .escape = "" },
.{ .escape = "" },
.{ .escape = "" },
.{ .escape = "" },
.{ .escape = "" },
style.rgb(95, 133, 99),
style.rgb(95, 129, 78),
style.rgb(94, 121, 66),
style.rgb(93, 115, 45),
style.rgb(93, 110, 34),
style.rgb(93, 115, 45),
style.rgb(94, 121, 66),
style.rgb(95, 129, 78),
style.rgb(95, 133, 99),
};
pub fn init(loc: Point) Nucleus {
return .{
.location = loc,
.stlye_loop_ctr = 0,
.style_loop_ctr = 0,
.widget = .{
.geometryFn = Nucleus.geometry,
.renderFn = Nucleus.render,
},
};
}
@@ -47,7 +49,14 @@ pub const Nucleus = struct {
pub fn render(widget: *Widget, frame: *SubMatrix(Cell)) WidgetError!void {
const self: *@This() = @fieldParentPtr("widget", widget);
var row = frame.rowable.row(0) catch return WidgetError.UnknownError;
@memcpy(row[0..ending], self.text[0..ending]);
frame.set(
.{ .x = 0, .y = 0 },
.{
.char = ("Ω" ** 4).*,
.width = 2,
.style = healthy_loop[(self.style_loop_ctr / 5) % healthy_loop.len],
},
) catch return WidgetError.UnknownError;
self.style_loop_ctr += 1;
}
};