refactor: add renderer abstraction layer
This commit is contained in:
parent
9ff63fbed5
commit
b15fa47f30
47 changed files with 1419 additions and 1023 deletions
|
@ -1,8 +1,9 @@
|
|||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const nc = @import("notcurses");
|
||||
const tp = @import("thespian");
|
||||
|
||||
const Plane = @import("renderer").Plane;
|
||||
|
||||
pub const Box = @import("Box.zig");
|
||||
pub const EventHandler = @import("EventHandler.zig");
|
||||
pub const Theme = @import("theme");
|
||||
|
@ -10,7 +11,7 @@ pub const themes = @import("themes").themes;
|
|||
pub const scopes = @import("themes").scopes;
|
||||
|
||||
ptr: *anyopaque,
|
||||
plane: *nc.Plane,
|
||||
plane: *Plane,
|
||||
vtable: *const VTable,
|
||||
|
||||
const Self = @This();
|
||||
|
@ -209,10 +210,10 @@ pub fn walk(self: *Self, walk_ctx: *anyopaque, f: WalkFn) bool {
|
|||
return if (self.vtable.walk(self.ptr, walk_ctx, f, self)) true else f(walk_ctx, self);
|
||||
}
|
||||
|
||||
pub fn empty(a: Allocator, parent: nc.Plane, layout_: Layout) !Self {
|
||||
const child: type = struct { plane: nc.Plane, layout: Layout };
|
||||
pub fn empty(a: Allocator, parent: Plane, layout_: Layout) !Self {
|
||||
const child: type = struct { plane: Plane, layout: Layout };
|
||||
const widget = try a.create(child);
|
||||
const n = try nc.Plane.init(&(Box{}).opts("empty"), parent);
|
||||
const n = try Plane.init(&(Box{}).opts("empty"), parent);
|
||||
widget.* = .{ .plane = n, .layout = layout_ };
|
||||
return .{
|
||||
.ptr = widget,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue