aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_fps_count.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_get_fps_count.c')
-rw-r--r--src/ft_get_fps_count.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ft_get_fps_count.c b/src/ft_get_fps_count.c
index 1f717e8..990f0ea 100644
--- a/src/ft_get_fps_count.c
+++ b/src/ft_get_fps_count.c
@@ -17,19 +17,19 @@
#include <time.h>
void
- ft_get_fps_count(clock_t dt, t_cub *cl)
+ ft_get_fps_count(clock_t before, t_cub *cl)
{
- static clock_t curr_time = 0;
+ static clock_t dt = 0;
static uint16_t ticks = 0;
+ clock_t curr;
- curr_time += dt;
+ curr = clock();
+ dt += curr - before;
ticks += 1;
- if (cl->plist.fire == 1)
- ft_handle_firing(dt, cl);
- if (dt > 0 && ft_clock_to_ms(curr_time) > 1000.0)
+ if (dt > 0 && ft_clock_to_ms(dt) > 1000.0)
{
ft_sprintf(cl->fps_count, "fps: %hu", ticks);
ticks = 0;
- curr_time -= CLOCKS_PER_SEC;
+ dt = 0;
}
}