refactor: add renderer abstraction layer
This commit is contained in:
parent
9ff63fbed5
commit
b15fa47f30
47 changed files with 1419 additions and 1023 deletions
|
@ -1,9 +1,10 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const nc = @import("notcurses");
|
||||
const tp = @import("thespian");
|
||||
const tracy = @import("tracy");
|
||||
|
||||
const Plane = @import("renderer").Plane;
|
||||
|
||||
const Widget = @import("../Widget.zig");
|
||||
const Button = @import("../Button.zig");
|
||||
const tui = @import("../tui.zig");
|
||||
|
@ -17,7 +18,7 @@ rendered: [:0]const u8 = "",
|
|||
|
||||
const Self = @This();
|
||||
|
||||
pub fn create(a: Allocator, parent: nc.Plane) !Widget {
|
||||
pub fn create(a: Allocator, parent: Plane) !Widget {
|
||||
return Button.create_widget(Self, a, parent, .{
|
||||
.ctx = .{},
|
||||
.label = "",
|
||||
|
@ -37,7 +38,7 @@ pub fn layout(self: *Self, _: *Button.State(Self)) Widget.Layout {
|
|||
}
|
||||
|
||||
pub fn render(self: *Self, btn: *Button.State(Self), theme: *const Widget.Theme) bool {
|
||||
tui.set_base_style(&btn.plane, " ", if (btn.active) theme.editor_cursor else if (btn.hover) theme.statusbar_hover else theme.statusbar);
|
||||
btn.plane.set_base_style(" ", if (btn.active) theme.editor_cursor else if (btn.hover) theme.statusbar_hover else theme.statusbar);
|
||||
btn.plane.erase();
|
||||
btn.plane.home();
|
||||
_ = btn.plane.putstr(self.rendered) catch {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue