From fad46137a08a24be0b63509e79fc03f70858eee2 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Sun, 26 Jan 2025 09:09:21 +0300 Subject: [PATCH] set ctx.frame_duration --- include/twn_context.h | 1 - src/twn_loop.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/include/twn_context.h b/include/twn_context.h index 8cdb342..b312112 100644 --- a/include/twn_context.h +++ b/include/twn_context.h @@ -20,7 +20,6 @@ typedef struct Context { /* real time spent on one frame (in seconds) */ /* townengine is fixed step based, so you don't have to use delta */ - /* TODO: actually set it */ float frame_duration; /* it is disabled by having fog_density approximately equal to zero */ diff --git a/src/twn_loop.c b/src/twn_loop.c index ab49e36..12bacaf 100644 --- a/src/twn_loop.c +++ b/src/twn_loop.c @@ -532,6 +532,7 @@ static bool initialize(void) { ctx.desired_frametime = ctx.clocks_per_second / ctx.ticks_per_second; ctx.frame_accumulator = 0; ctx.game.frame_number = 0; + ctx.game.frame_duration = 1.0f / (float)ctx.ticks_per_second; /* delta time averaging */ ctx.delta_averager_residual = 0;