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:
15
src/main.c
15
src/main.c
@@ -100,6 +100,7 @@ int main(void)
|
|||||||
camera.rotation = 0.0f;
|
camera.rotation = 0.0f;
|
||||||
camera.zoom = 1.0f;
|
camera.zoom = 1.0f;
|
||||||
|
|
||||||
|
bool single_tick = false;
|
||||||
for (size_t ticks = 0; !WindowShouldClose(); ++ticks)
|
for (size_t ticks = 0; !WindowShouldClose(); ++ticks)
|
||||||
{
|
{
|
||||||
if (IsKeyPressed(KEY_SPACE))
|
if (IsKeyPressed(KEY_SPACE))
|
||||||
@@ -140,6 +141,20 @@ int main(void)
|
|||||||
camera.zoom = 1.0f;
|
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 &&
|
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && camera.zoom == 1.0f &&
|
||||||
camera.offset.x == 0 && camera.offset.y == 0)
|
camera.offset.x == 0 && camera.offset.y == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user