Continuing example and still working on adaption the CLAY macro

This commit is contained in:
Stowy 2025-01-01 19:28:22 +01:00
parent e9522005db
commit b7e1d69ca6
3 changed files with 108 additions and 9 deletions

View file

@ -76,18 +76,57 @@ main :: () {
};
Clay.BeginLayout();
if Clay.UI(
Clay.UI(
Clay.ID("OuterContainer"),
Clay.Rectangle(.{color = .{43, 41, 51, 255}}),
Clay.Layout(.{
layoutDirection = .TOP_TO_BOTTOM,
sizing = layout_expand,
padding = .{16, 16},
childGap = 16,
}),
Clay.Rectangle(.{color = .{43, 41, 51, 255}})
) {
children = #code {
Clay.UI(
Clay.ID("HeaderBar"),
Clay.Rectangle(content_background_config),
Clay.Layout(.{
sizing = .{
height = Clay.SizingFixed(60),
width = Clay.SizingGrow(),
},
padding = .{16, 16},
childGap = 16,
childAlignment = .{
y = .CENTER,
}
}),
children = #code {
Clay.UI(
Clay.ID("FileButton"),
Clay.Layout(.{padding = .{16, 8}}),
Clay.Rectangle(.{
color = .{140, 140, 140, 255},
cornerRadius = .{5, 5, 5, 5},
}),
children = #code {
Clay.Text("File", Clay.TextConfig(.{
fontId = FONT_ID_BODY_16,
fontSize = 16,
textColor = Clay.Color.{255, 255, 255, 255},
}));
}
file_menu_visible := Clay.PointerOver(Clay.GetElementId("FileButton")) ||
Clay.PointerOver(Clay.GetElementId("FileMenu"));
if file_menu_visible {
}
}
);
}
);
}
);
render_commands := Clay.EndLayout();

View file

@ -0,0 +1,21 @@
#import "Basic";
test :: () -> bool #must #expand {
print("one\n");
`defer print("two\n");
return true;
}
main :: () {
print("ichi\n");
if test() {
print("ni\n");
if test() {
print("san\n");
}
}
print("yon\n");
}