mirror of
https://codeberg.org/fairyglade/ly.git
synced 2026-08-22 05:24:24 +02:00
feat(animations): wire bonsai into renderer
Adds the `.bonsai` variant to the Animation enum and a matching arm in main.zig's animation switch that reads the `bonsai_*` config fields and constructs the widget. The example config.ini's animation comment list is updated to mention the new option. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7b56998f7c
commit
6c99e7f8bd
3 changed files with 24 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ allow_empty_password = true
|
|||
# colormix -> Color mixing shader
|
||||
# gameoflife -> John Conway's Game of Life
|
||||
# dur_file -> .dur file format (https://github.com/cmang/durdraw/tree/master)
|
||||
# bonsai -> Procedurally-generated ASCII bonsai tree (port of cbonsai)
|
||||
animation = none
|
||||
|
||||
# Delay between each animation frame in milliseconds
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ pub const Animation = enum {
|
|||
colormix,
|
||||
gameoflife,
|
||||
dur_file,
|
||||
bonsai,
|
||||
};
|
||||
|
||||
pub const DisplayServer = enum {
|
||||
|
|
|
|||
22
src/main.zig
22
src/main.zig
|
|
@ -23,6 +23,7 @@ const IniParser = ly_core.IniParser;
|
|||
const ini = ly_core.ini;
|
||||
const Ini = ini.Ini;
|
||||
|
||||
const Bonsai = @import("animations/Bonsai.zig");
|
||||
const Cascade = @import("animations/Cascade.zig");
|
||||
const ColorMix = @import("animations/ColorMix.zig");
|
||||
const Doom = @import("animations/Doom.zig");
|
||||
|
|
@ -1089,6 +1090,27 @@ pub fn main(init: std.process.Init) !void {
|
|||
);
|
||||
animation = dur.widget();
|
||||
},
|
||||
.bonsai => {
|
||||
var bonsai = try Bonsai.init(
|
||||
state.allocator,
|
||||
&state.buffer,
|
||||
state.config.bonsai_base_type,
|
||||
state.config.bonsai_life,
|
||||
state.config.bonsai_multiplier,
|
||||
state.config.bonsai_leaves,
|
||||
state.config.bonsai_leaf_dark,
|
||||
state.config.bonsai_leaf_bright,
|
||||
state.config.bonsai_wood_dark,
|
||||
state.config.bonsai_wood_bright,
|
||||
state.config.bonsai_text_color,
|
||||
state.config.bonsai_step_ms,
|
||||
state.config.bonsai_finish_pause_ms,
|
||||
&state.animate,
|
||||
state.config.animation_timeout_sec,
|
||||
state.config.animation_frame_delay,
|
||||
);
|
||||
animation = bonsai.widget();
|
||||
},
|
||||
}
|
||||
defer if (animation) |a| a.deinit();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue