feat: improved simulation frame delta controls
This commit is contained in:
parent
99ec92ba88
commit
107bd6cff5
|
|
@ -11,6 +11,9 @@ static bool isSimulating{ false };
|
||||||
static void SetSimulatingButton(Clay_ElementId element, Clay_PointerData pointer, intptr_t data) {
|
static void SetSimulatingButton(Clay_ElementId element, Clay_PointerData pointer, intptr_t data) {
|
||||||
if (pointer.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) {
|
if (pointer.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) {
|
||||||
isSimulating = data == 1;
|
isSimulating = data == 1;
|
||||||
|
if (isSimulating) {
|
||||||
|
simulation::drawDebugInfo = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,6 +51,67 @@ static void StepControl() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void DebugInfoLegend() {
|
||||||
|
CLAY_AUTO_ID(style::PanelContainer(1, {
|
||||||
|
.layout = {
|
||||||
|
.padding = {
|
||||||
|
.left = 20, .right = 0, .top = 0, .bottom = 0
|
||||||
|
},
|
||||||
|
.childGap = 10,
|
||||||
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
|
}
|
||||||
|
})) {
|
||||||
|
CLAY_AUTO_ID({
|
||||||
|
.layout = {
|
||||||
|
.childGap = 10,
|
||||||
|
},
|
||||||
|
}) {
|
||||||
|
CLAY_AUTO_ID({
|
||||||
|
.layout = {
|
||||||
|
.sizing = { CLAY_SIZING_FIXED(20), CLAY_SIZING_FIXED(20) }
|
||||||
|
},
|
||||||
|
.border = { {255, 0, 255, 255 }, CLAY_BORDER_OUTSIDE(3) }
|
||||||
|
});
|
||||||
|
elements::Body(CLAY_STRING("Underpopulated"), {
|
||||||
|
.textColor = style::TextColors(0)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
CLAY_AUTO_ID({
|
||||||
|
.layout = {
|
||||||
|
.childGap = 10,
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
CLAY_AUTO_ID({
|
||||||
|
.layout = {
|
||||||
|
.sizing = { CLAY_SIZING_FIXED(20), CLAY_SIZING_FIXED(20) }
|
||||||
|
},
|
||||||
|
.border = { {255, 0, 0, 255 }, CLAY_BORDER_OUTSIDE(3) }
|
||||||
|
});
|
||||||
|
elements::Body(CLAY_STRING("Overpopulated"), {
|
||||||
|
.textColor = style::TextColors(0)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
CLAY_AUTO_ID({
|
||||||
|
.layout = {
|
||||||
|
.childGap = 10,
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
CLAY_AUTO_ID({
|
||||||
|
.layout = {
|
||||||
|
.sizing = { CLAY_SIZING_FIXED(20), CLAY_SIZING_FIXED(20) }
|
||||||
|
},
|
||||||
|
.border = { {0, 255, 0, 255 }, CLAY_BORDER_OUTSIDE(3) }
|
||||||
|
});
|
||||||
|
elements::Body(CLAY_STRING("Born"), {
|
||||||
|
.textColor = style::TextColors(0)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
elements::Body(CLAY_STRING("Warning: Drawing simulation changes\ngreatly lowers performance"), {
|
||||||
|
.textColor = style::TextColors(3)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void PrimaryControls() {
|
static void PrimaryControls() {
|
||||||
static bool isOpen{ true };
|
static bool isOpen{ true };
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
|
|
@ -67,12 +131,17 @@ static void PrimaryControls() {
|
||||||
}) {
|
}) {
|
||||||
StepControl();
|
StepControl();
|
||||||
if (!isSimulating) {
|
if (!isSimulating) {
|
||||||
elements::TextButton(CLAY_STRING("Randomize"), style::actionButton, &RandomizeFieldButton);
|
CLAY_AUTO_ID(style::PanelContainer(1, {})) {
|
||||||
|
elements::TextButton(CLAY_STRING("Randomize"), style::actionButton, &RandomizeFieldButton);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elements::Toggle(CLAY_STRING("Debug Info"), style::actionButton, simulation::drawDebugInfo);
|
elements::Toggle(CLAY_STRING("Show Changes"), style::actionButton, simulation::drawDebugInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (simulation::drawDebugInfo) {
|
||||||
|
DebugInfoLegend();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Clay_RenderCommandArray RenderApplication() {
|
Clay_RenderCommandArray RenderApplication() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue