diff options
| author | onelin <oscar@nelin.dk> | 2025-03-12 11:39:47 +0000 |
|---|---|---|
| committer | onelin <oscar@nelin.dk> | 2025-03-12 11:40:38 +0000 |
| commit | c3bd31cf9f6e9a010eefed0a9b123becceeafd9f (patch) | |
| tree | 37097a3d56281f394d9c8106337f8ac193670090 | |
| parent | d51f8c276a67878c8fa04ae50bc3de02e188e708 (diff) | |
Get fps cap in loop
| -rw-r--r-- | src/core/src/loop.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/src/loop.c b/src/core/src/loop.c index d80e350..15d6ae1 100644 --- a/src/core/src/loop.c +++ b/src/core/src/loop.c @@ -304,10 +304,11 @@ i32 engine_run(Platform* p, StateType initial_state, void* state_arg) { StateType (*update_func)(f64, void*) = State_updateFunc(state); -//#ifdef BENCHMARK - f64 last_fps_measurement = get_time(); - f64 last_fps_ticks = 0; -//#endif + f64 last_fps_measurement = time; + u64 last_fps_ticks = 0; + + /* The target frametime measured in milliseconds */ + const f64 fps_cap = p->fps_target > 0 ? 1000.0 / (f64)p->fps_target : 0; /* Main loop */ do { |
