diff --git a/res/config.ini b/res/config.ini index 0a1a240..51f17be 100644 --- a/res/config.ini +++ b/res/config.ini @@ -4,6 +4,9 @@ # matrix -> CMatrix animation = none +# Adjust doom animation speed by adding some delay (in milliseconds) when it draws the flames. +doom_delay = 0 + # Format string for clock in top right corner (see strftime specification). Example: %c clock = null diff --git a/src/animations/Doom.zig b/src/animations/Doom.zig index 1583165..ed092d2 100644 --- a/src/animations/Doom.zig +++ b/src/animations/Doom.zig @@ -28,8 +28,9 @@ pub const FIRE = [_]termbox.tb_cell{ allocator: Allocator, terminal_buffer: *TerminalBuffer, buffer: []u8, +delay: u64, -pub fn init(allocator: Allocator, terminal_buffer: *TerminalBuffer) !Doom { +pub fn init(allocator: Allocator, terminal_buffer: *TerminalBuffer, delay: u64) !Doom { const buffer = try allocator.alloc(u8, terminal_buffer.width * terminal_buffer.height); initBuffer(buffer, terminal_buffer.width); @@ -37,6 +38,7 @@ pub fn init(allocator: Allocator, terminal_buffer: *TerminalBuffer) !Doom { .allocator = allocator, .terminal_buffer = terminal_buffer, .buffer = buffer, + .delay = delay, }; } @@ -72,6 +74,8 @@ pub fn draw(self: Doom) void { self.terminal_buffer.buffer[source] = FIRE[buffer_source]; } } + // Delay related code + std.time.sleep(std.time.ns_per_ms * self.delay); } fn initBuffer(buffer: []u8, width: u64) void { diff --git a/src/config/Config.zig b/src/config/Config.zig index 168a6f7..2fee5c0 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -11,12 +11,17 @@ bigclock: bool = false, blank_box: bool = true, border_fg: u8 = 8, box_title: ?[]const u8 = null, +brightness_down_key: []const u8 = "F5", +brightness_up_key: []const u8 = "F6", +brightnessctl: []const u8 = "/usr/bin/brightnessctl", +brightness_change: []const u8 = "10", clear_password: bool = false, clock: ?[:0]const u8 = null, +cmatrix_fg: u8 = 3, console_dev: [:0]const u8 = "/dev/console", default_input: Input = .login, +doom_delay: u64 = 0, fg: u8 = 8, -cmatrix_fg: u8 = 3, hide_borders: bool = false, hide_key_hints: bool = false, initial_info_text: ?[]const u8 = null, @@ -52,7 +57,3 @@ xinitrc: ?[]const u8 = "~/.xinitrc", x_cmd_setup: []const u8 = build_options.data_directory ++ "/xsetup.sh", xauth_cmd: []const u8 = "/usr/bin/xauth", xsessions: []const u8 = "/usr/share/xsessions", -brightness_down_key: []const u8 = "F5", -brightness_up_key: []const u8 = "F6", -brightnessctl: []const u8 = "/usr/bin/brightnessctl", -brightness_change: []const u8 = "10", diff --git a/src/main.zig b/src/main.zig index 05c06e6..9a19ef8 100644 --- a/src/main.zig +++ b/src/main.zig @@ -229,7 +229,7 @@ pub fn main() !void { switch (config.animation) { .none => {}, - .doom => doom = try Doom.init(allocator, &buffer), + .doom => doom = try Doom.init(allocator, &buffer, config.doom_delay), .matrix => matrix = try Matrix.init(allocator, &buffer, config.cmatrix_fg), } defer {