main: add single_tick to iterate through steps in rough lockstep

Obviously we're not using a hard measure to stop threads in exactly
one step or anything.
This commit is contained in:
2026-03-18 17:30:03 +00:00
parent e5640d19f2
commit f0d4657071

View File

@@ -100,6 +100,7 @@ int main(void)
camera.rotation = 0.0f;
camera.zoom = 1.0f;
bool single_tick = false;
for (size_t ticks = 0; !WindowShouldClose(); ++ticks)
{
if (IsKeyPressed(KEY_SPACE))
@@ -140,6 +141,20 @@ int main(void)
camera.zoom = 1.0f;
}
if (single_tick)
{
single_tick = false;
state_iterator.paused = true;
state_mutator.paused = true;
}
if (IsKeyPressed(KEY_COMMA))
{
single_tick = true;
state_iterator.paused = false;
state_mutator.paused = false;
}
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && camera.zoom == 1.0f &&
camera.offset.x == 0 && camera.offset.y == 0)
{