mirror of
https://github.com/fairyglade/ly.git
synced 2026-08-07 13:42:00 +00:00
Add central Widget struct + clean up code
In particular, move all termbox2 usage to TerminalBuffer.zig & keyboard.zig Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
const std = @import("std");
|
||||
const math = std.math;
|
||||
|
||||
const Animation = @import("../tui/Animation.zig");
|
||||
const Cell = @import("../tui/Cell.zig");
|
||||
const TerminalBuffer = @import("../tui/TerminalBuffer.zig");
|
||||
const Widget = @import("../tui/Widget.zig");
|
||||
|
||||
const ColorMix = @This();
|
||||
|
||||
@@ -45,14 +45,17 @@ pub fn init(terminal_buffer: *TerminalBuffer, col1: u32, col2: u32, col3: u32) C
|
||||
};
|
||||
}
|
||||
|
||||
pub fn animation(self: *ColorMix) Animation {
|
||||
return Animation.init(self, deinit, realloc, draw);
|
||||
pub fn widget(self: *ColorMix) Widget {
|
||||
return Widget.init(
|
||||
self,
|
||||
null,
|
||||
null,
|
||||
draw,
|
||||
null,
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
||||
fn deinit(_: *ColorMix) void {}
|
||||
|
||||
fn realloc(_: *ColorMix) anyerror!void {}
|
||||
|
||||
fn draw(self: *ColorMix) void {
|
||||
self.frames +%= 1;
|
||||
const time: f32 = @as(f32, @floatFromInt(self.frames)) * time_scale;
|
||||
|
||||
Reference in New Issue
Block a user