ona/demos/canvas.zig

32 lines
619 B
Zig
Raw Normal View History

2024-07-30 00:50:40 +02:00
const gfx = @import("gfx");
const gui = @import("gui");
const hid = @import("hid");
const ona = @import("ona");
pub const main = ona.App.game
.with_module(gfx)
.with_module(hid)
.with_module(gui)
.with_system(.load, ona.system_fn(load), .{ .label = "Hello Ona" }).build();
pub fn load(canvas: ona.Write(gui.Canvas)) !void {
const item = try canvas.state.append("", .{
.left = 0,
.top = 0,
.width = 256,
.height = 256,
});
canvas.state.set_block(item, .{
.has_background = .default,
.has_color = gfx.colors.purple,
});
try canvas.state.set_label(item, .{
.has_text = "Hello, world",
});
}