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