summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-12-01 09:51:10 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-12-01 09:51:10 +0100
commit6615a01df56d410a17b724d42660eb9821087470 (patch)
tree4d39daff8b6182529c05dc4ad20e8834275d003c
parent0a3ac6ef061de74cc635ae3068d954cbd72f1c33 (diff)
close #29
-rw-r--r--src/world.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/world.c b/src/world.c
index 9eede87..bff0345 100644
--- a/src/world.c
+++ b/src/world.c
@@ -1435,7 +1435,12 @@ static void world_run_simulation_tick(world* world)
void world_update(platform_window* window, world* world)
{
- world_run_simulation_tick(world);
+ static float delta = 0;
+ delta += frame_delta;
+ if (delta >= (1/60.0f)) { // tick runs at 60 ticks per second regardless of fps.
+ world_run_simulation_tick(world);
+ delta = 0;
+ }
}
static vec2f get_world_location_for_job(platform_window* window, world* world, active_job* job)