New features: - Easing functions: linear, ease-in/out, cubic, expo, bounce, elastic, back - Animation struct for tweening values over time - AnimationGroup for parallel/sequential animations - Timer for frame-based updates (one-shot and repeating) - Helper functions: lerp, inverseLerp, mapRange Animation features: - Configurable repeat count (-1 for infinite) - Ping-pong mode (reverse on repeat) - Delay before start - Pause/resume control - getValue as f64, i64, or u16 Example: animation_demo.zig comparing 5 easing functions Tests: 12 animation tests, all pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
159 lines
5.3 KiB
Zig
159 lines
5.3 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
// Módulo de la librería
|
|
const zcatui_mod = b.createModule(.{
|
|
.root_source_file = b.path("src/root.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
|
|
// Tests
|
|
const unit_tests = b.addTest(.{
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("src/root.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
}),
|
|
});
|
|
|
|
const run_unit_tests = b.addRunArtifact(unit_tests);
|
|
const test_step = b.step("test", "Ejecutar tests");
|
|
test_step.dependOn(&run_unit_tests.step);
|
|
|
|
// Ejemplo: hello
|
|
const hello_exe = b.addExecutable(.{
|
|
.name = "hello",
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("examples/hello.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.imports = &.{
|
|
.{ .name = "zcatui", .module = zcatui_mod },
|
|
},
|
|
}),
|
|
});
|
|
b.installArtifact(hello_exe);
|
|
|
|
const run_hello = b.addRunArtifact(hello_exe);
|
|
run_hello.step.dependOn(b.getInstallStep());
|
|
const hello_step = b.step("hello", "Ejecutar ejemplo hello");
|
|
hello_step.dependOn(&run_hello.step);
|
|
|
|
// Ejemplo: events_demo
|
|
const events_demo_exe = b.addExecutable(.{
|
|
.name = "events-demo",
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("examples/events_demo.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.imports = &.{
|
|
.{ .name = "zcatui", .module = zcatui_mod },
|
|
},
|
|
}),
|
|
});
|
|
b.installArtifact(events_demo_exe);
|
|
|
|
const run_events_demo = b.addRunArtifact(events_demo_exe);
|
|
run_events_demo.step.dependOn(b.getInstallStep());
|
|
const events_demo_step = b.step("events-demo", "Run events demo");
|
|
events_demo_step.dependOn(&run_events_demo.step);
|
|
|
|
// Ejemplo: list_demo
|
|
const list_demo_exe = b.addExecutable(.{
|
|
.name = "list-demo",
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("examples/list_demo.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.imports = &.{
|
|
.{ .name = "zcatui", .module = zcatui_mod },
|
|
},
|
|
}),
|
|
});
|
|
b.installArtifact(list_demo_exe);
|
|
|
|
const run_list_demo = b.addRunArtifact(list_demo_exe);
|
|
run_list_demo.step.dependOn(b.getInstallStep());
|
|
const list_demo_step = b.step("list-demo", "Run list demo");
|
|
list_demo_step.dependOn(&run_list_demo.step);
|
|
|
|
// Ejemplo: table_demo
|
|
const table_demo_exe = b.addExecutable(.{
|
|
.name = "table-demo",
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("examples/table_demo.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.imports = &.{
|
|
.{ .name = "zcatui", .module = zcatui_mod },
|
|
},
|
|
}),
|
|
});
|
|
b.installArtifact(table_demo_exe);
|
|
|
|
const run_table_demo = b.addRunArtifact(table_demo_exe);
|
|
run_table_demo.step.dependOn(b.getInstallStep());
|
|
const table_demo_step = b.step("table-demo", "Run table demo");
|
|
table_demo_step.dependOn(&run_table_demo.step);
|
|
|
|
// Ejemplo: dashboard
|
|
const dashboard_exe = b.addExecutable(.{
|
|
.name = "dashboard",
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("examples/dashboard.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.imports = &.{
|
|
.{ .name = "zcatui", .module = zcatui_mod },
|
|
},
|
|
}),
|
|
});
|
|
b.installArtifact(dashboard_exe);
|
|
|
|
const run_dashboard = b.addRunArtifact(dashboard_exe);
|
|
run_dashboard.step.dependOn(b.getInstallStep());
|
|
const dashboard_step = b.step("dashboard", "Run dashboard demo");
|
|
dashboard_step.dependOn(&run_dashboard.step);
|
|
|
|
// Ejemplo: input_demo
|
|
const input_demo_exe = b.addExecutable(.{
|
|
.name = "input-demo",
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("examples/input_demo.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.imports = &.{
|
|
.{ .name = "zcatui", .module = zcatui_mod },
|
|
},
|
|
}),
|
|
});
|
|
b.installArtifact(input_demo_exe);
|
|
|
|
const run_input_demo = b.addRunArtifact(input_demo_exe);
|
|
run_input_demo.step.dependOn(b.getInstallStep());
|
|
const input_demo_step = b.step("input-demo", "Run input demo");
|
|
input_demo_step.dependOn(&run_input_demo.step);
|
|
|
|
// Ejemplo: animation_demo
|
|
const animation_demo_exe = b.addExecutable(.{
|
|
.name = "animation-demo",
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("examples/animation_demo.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.imports = &.{
|
|
.{ .name = "zcatui", .module = zcatui_mod },
|
|
},
|
|
}),
|
|
});
|
|
b.installArtifact(animation_demo_exe);
|
|
|
|
const run_animation_demo = b.addRunArtifact(animation_demo_exe);
|
|
run_animation_demo.step.dependOn(b.getInstallStep());
|
|
const animation_demo_step = b.step("animation-demo", "Run animation demo");
|
|
animation_demo_step.dependOn(&run_animation_demo.step);
|
|
}
|