2024-01-19 03:17:26 +01:00
|
|
|
const std = @import("std");
|
|
|
|
const odditui = @import("odditui");
|
|
|
|
|
|
|
|
const log = std.log.scoped(.main);
|
|
|
|
pub fn main() !void {
|
|
|
|
var app: odditui.App(Event) = try odditui.App(Event).init(.{});
|
|
|
|
defer app.deinit();
|
|
|
|
|
|
|
|
try app.start();
|
|
|
|
defer app.stop();
|
|
|
|
|
|
|
|
outer: while (true) {
|
|
|
|
const event = app.nextEvent();
|
|
|
|
switch (event) {
|
|
|
|
.key_press => |key| {
|
|
|
|
if (key.codepoint == 'c' and key.mods.ctrl) {
|
|
|
|
break :outer;
|
|
|
|
}
|
|
|
|
},
|
2024-01-19 05:37:48 +01:00
|
|
|
.winsize => {},
|
2024-01-19 03:17:26 +01:00
|
|
|
else => {},
|
|
|
|
}
|
2024-01-19 03:35:33 +01:00
|
|
|
log.debug("event: {}\r\n", .{event});
|
2024-01-19 03:17:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const Event = union(enum) {
|
|
|
|
key_press: odditui.Key,
|
2024-01-19 05:37:48 +01:00
|
|
|
winsize: std.os.system.winsize,
|
2024-01-19 03:17:26 +01:00
|
|
|
mouse: u8,
|
|
|
|
};
|