feat: minor adjustments to UI layout

This commit is contained in:
Sara Gerretsen 2025-09-22 23:13:32 +02:00
parent 98ee5fd73d
commit f393775fc8

View file

@ -33,6 +33,8 @@ static void StepControl() {
CLAY_AUTO_ID(style::PanelContainer(1, {
.layout = {
.sizing = { CLAY_SIZING_GROW(), CLAY_SIZING_FIT() },
.childGap = 16,
.layoutDirection = CLAY_TOP_TO_BOTTOM,
},
})) {
CLAY_AUTO_ID({
@ -47,11 +49,12 @@ static void StepControl() {
elements::TextButton(CLAY_STRING("Step"), style::actionButton, &StepSimulationButton);
}
}
elements::Toggle(CLAY_STRING("Show Changes"), style::actionButton, simulation::drawDebugInfo);
}
}
static void DebugInfoLegend() {
CLAY_AUTO_ID(style::PanelContainer(1, {
Clay_ElementDeclaration style{style::PanelContainer(1, {
.layout = {
.padding = {
.left = 20, .right = 0, .top = 0, .bottom = 0
@ -59,7 +62,10 @@ static void DebugInfoLegend() {
.childGap = 10,
.layoutDirection = CLAY_TOP_TO_BOTTOM,
}
})) {
})
};
style.cornerRadius = { 0, style::defaultRadius, 0, style::defaultRadius };
CLAY_AUTO_ID(style) {
CLAY_AUTO_ID({
.layout = {
.childGap = 10,
@ -105,8 +111,8 @@ static void DebugInfoLegend() {
.textColor = style::TextColor(0)
});
}
elements::Body(CLAY_STRING("Warning: Drawing simulation changes\ngreatly lowers performance"), {
.textColor = style::TextColor(3)
elements::Body(CLAY_STRING("Warning:\nDrawing simulation\nchanges greatly\nlowers performance."), {
.textColor = style::TextColor(2)
});
}
}
@ -130,15 +136,12 @@ static void PrimaryControls() {
}) {
StepControl();
if (!isSimulating) {
CLAY_AUTO_ID(style::PanelContainer(1, {
.layout = {
.sizing = { CLAY_SIZING_GROW(), CLAY_SIZING_FIT() }
}
CLAY_AUTO_ID(style::LeftPanelContainer(1, {
.layout = { .sizing = { CLAY_SIZING_GROW(), CLAY_SIZING_FIT() } }
})) {
elements::TextButton(CLAY_STRING("Randomize"), style::actionButton, &RandomizeFieldButton);
}
}
elements::Toggle(CLAY_STRING("Show Changes"), style::actionButton, simulation::drawDebugInfo);
}
}
}
@ -155,6 +158,7 @@ Clay_RenderCommandArray RenderApplication() {
simulation::Step();
}
}
Clay_BeginLayout();
CLAY(CLAY_ID("OuterContainer"), style::Window()) {
simulation::SetSimulationHovered(Clay_Hovered());