diff options
Diffstat (limited to 'src/ft_get_fps_count.c')
-rw-r--r-- | src/ft_get_fps_count.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ft_get_fps_count.c b/src/ft_get_fps_count.c index 63bf08e..f7f0177 100644 --- a/src/ft_get_fps_count.c +++ b/src/ft_get_fps_count.c @@ -22,7 +22,6 @@ static float return ((ticks / (float)CLOCKS_PER_SEC) * 1000.0); } - static void ft_handle_firing(clock_t dt, t_cub *cl) { @@ -40,13 +39,16 @@ void ft_get_fps_count(clock_t dt, t_cub *cl) { static clock_t curr_time = 0; + static uint16_t ticks = 0; curr_time += dt; + ticks += 1; if (cl->plist.fire == 1) ft_handle_firing(dt, cl); if (dt > 0 && ft_clock_to_ms(curr_time) > 1000.0) { - ft_sprintf(cl->fps_count, "fps: %ld", (uint32_t)CLOCKS_PER_SEC / dt); + ft_sprintf(cl->fps_count, "fps: %hu", ticks); + ticks = 0; curr_time -= CLOCKS_PER_SEC; } } |