add(example): input with simple text field
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m41s

This commit is contained in:
2025-02-20 23:48:57 +01:00
parent 07e932741c
commit c4639bf4bb
3 changed files with 148 additions and 16 deletions

View File

@@ -5,6 +5,7 @@ pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const Examples = enum {
Input,
Layout,
Scrollable,
};
@@ -28,14 +29,14 @@ pub fn build(b: *std.Build) void {
});
lib.addImport("code_point", zg.module("code_point"));
// Examples.Scrollable
const scrollable = b.addExecutable(.{
.name = "scrollable",
.root_source_file = b.path("examples/scrollable.zig"),
// Examples.Input
const input = b.addExecutable(.{
.name = "input",
.root_source_file = b.path("examples/input.zig"),
.target = target,
.optimize = optimize,
});
scrollable.root_module.addImport("zterm", lib);
input.root_module.addImport("zterm", lib);
// Examples.Layout
const layout = b.addExecutable(.{
@@ -46,8 +47,18 @@ pub fn build(b: *std.Build) void {
});
layout.root_module.addImport("zterm", lib);
// Examples.Scrollable
const scrollable = b.addExecutable(.{
.name = "scrollable",
.root_source_file = b.path("examples/scrollable.zig"),
.target = target,
.optimize = optimize,
});
scrollable.root_module.addImport("zterm", lib);
// mapping of user selected example to compile step
const exe = switch (example) {
.Input => input,
.Layout => layout,
.Scrollable => scrollable,
};