mirror of https://github.com/fairyglade/ly.git
Final fixes, adding fg_ini as field
This commit is contained in:
parent
3dc1482603
commit
0badcd4a7e
|
@ -44,6 +44,9 @@ bg = 0
|
||||||
# Foreground color id
|
# Foreground color id
|
||||||
fg = 8
|
fg = 8
|
||||||
|
|
||||||
|
# CMatrix animation foreground color id
|
||||||
|
cmatrix_fg = 3
|
||||||
|
|
||||||
# Border color
|
# Border color
|
||||||
border_fg = 8
|
border_fg = 8
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,9 @@ dots: []Dot,
|
||||||
lines: []Line,
|
lines: []Line,
|
||||||
frame: u64,
|
frame: u64,
|
||||||
count: u64,
|
count: u64,
|
||||||
|
fg_ini: u16,
|
||||||
|
|
||||||
pub fn init(allocator: Allocator, terminal_buffer: *TerminalBuffer) !Matrix {
|
pub fn init(allocator: Allocator, terminal_buffer: *TerminalBuffer, fg_ini: u16) !Matrix {
|
||||||
const dots = try allocator.alloc(Dot, terminal_buffer.width * (terminal_buffer.height + 1));
|
const dots = try allocator.alloc(Dot, terminal_buffer.width * (terminal_buffer.height + 1));
|
||||||
const lines = try allocator.alloc(Line, terminal_buffer.width);
|
const lines = try allocator.alloc(Line, terminal_buffer.width);
|
||||||
|
|
||||||
|
@ -48,6 +49,7 @@ pub fn init(allocator: Allocator, terminal_buffer: *TerminalBuffer) !Matrix {
|
||||||
.lines = lines,
|
.lines = lines,
|
||||||
.frame = 3,
|
.frame = 3,
|
||||||
.count = 0,
|
.count = 0,
|
||||||
|
.fg_ini = fg_ini,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +147,8 @@ pub fn draw(self: *Matrix) void {
|
||||||
var y: u64 = 1;
|
var y: u64 = 1;
|
||||||
while (y <= self.terminal_buffer.height) : (y += 1) {
|
while (y <= self.terminal_buffer.height) : (y += 1) {
|
||||||
const dot = self.dots[buf_width * y + x];
|
const dot = self.dots[buf_width * y + x];
|
||||||
var fg: u16 = @intCast(termbox.TB_GREEN);
|
|
||||||
|
var fg: u16 = self.fg_ini;
|
||||||
|
|
||||||
if (dot.value == -1 or dot.value == ' ') {
|
if (dot.value == -1 or dot.value == ' ') {
|
||||||
_ = termbox.tb_set_cell(@intCast(x), @intCast(y - 1), ' ', fg, termbox.TB_DEFAULT);
|
_ = termbox.tb_set_cell(@intCast(x), @intCast(y - 1), ' ', fg, termbox.TB_DEFAULT);
|
||||||
|
|
|
@ -16,6 +16,7 @@ clock: ?[:0]const u8 = null,
|
||||||
console_dev: [:0]const u8 = "/dev/console",
|
console_dev: [:0]const u8 = "/dev/console",
|
||||||
default_input: Input = .login,
|
default_input: Input = .login,
|
||||||
fg: u8 = 8,
|
fg: u8 = 8,
|
||||||
|
cmatrix_fg: u8 = 3,
|
||||||
hide_borders: bool = false,
|
hide_borders: bool = false,
|
||||||
hide_key_hints: bool = false,
|
hide_key_hints: bool = false,
|
||||||
initial_info_text: ?[]const u8 = null,
|
initial_info_text: ?[]const u8 = null,
|
||||||
|
|
|
@ -230,7 +230,7 @@ pub fn main() !void {
|
||||||
switch (config.animation) {
|
switch (config.animation) {
|
||||||
.none => {},
|
.none => {},
|
||||||
.doom => doom = try Doom.init(allocator, &buffer),
|
.doom => doom = try Doom.init(allocator, &buffer),
|
||||||
.matrix => matrix = try Matrix.init(allocator, &buffer),
|
.matrix => matrix = try Matrix.init(allocator, &buffer, config.cmatrix_fg),
|
||||||
}
|
}
|
||||||
defer {
|
defer {
|
||||||
switch (config.animation) {
|
switch (config.animation) {
|
||||||
|
|
Loading…
Reference in New Issue