summaryrefslogtreecommitdiffhomepage
path: root/src/rodeo.c
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2023-05-30 03:51:43 -0400
committerrealtradam <[email protected]>2023-05-30 03:51:43 -0400
commit40a78e6865794db16988bf92a99f69c88c152c8a (patch)
tree1a8b0e7d36dee223eddfa1757d1510ec426dbcd8 /src/rodeo.c
parentb585f29788059e9040c9c5e3e32c341aa3881d84 (diff)
downloadRodeoKit-40a78e6865794db16988bf92a99f69c88c152c8a.tar.gz
RodeoKit-40a78e6865794db16988bf92a99f69c88c152c8a.zip
make frametime constant on web platform + other stuff
Diffstat (limited to 'src/rodeo.c')
-rw-r--r--src/rodeo.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rodeo.c b/src/rodeo.c
index c43b9a8..afeefba 100644
--- a/src/rodeo.c
+++ b/src/rodeo.c
@@ -338,7 +338,19 @@ rodeo_frame_end(void)
#endif
state.frame_count += 1;
state.end_frame = SDL_GetPerformanceCounter();
+
+#ifndef __EMSCRIPTEN__
state.frame_time = ((float)(state.end_frame - state.start_frame) * 1000.0f / (float)SDL_GetPerformanceFrequency());
+#else
+ state.frame_time = (1.0f/60.f) * 1000; //((float)(state.end_frame - state.start_frame) * 1000.0f / (float)SDL_GetPerformanceFrequency());
+#endif
+
+
+ /*
+ float minimum_fps = 20.0f;
+ float temp_frame_time = ((float)(state.end_frame - state.start_frame) * 1000.0f / (float)SDL_GetPerformanceFrequency());
+ state.frame_time = (temp_frame_time < ((1.0f/minimum_fps) * 1000)) ? temp_frame_time : ((1.0f / minimum_fps) * 1000);
+ */
}
void