/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_key_loop.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/17 20:06:26 by rbousset #+# #+# */ /* Updated: 2020/02/17 20:06:29 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include #include #include #include static float ft_clock_to_ms(clock_t ticks) { return ((ticks / (float)CLOCKS_PER_SEC) * 1000.0); } #include void ft_get_fps_count(clock_t dt, t_cub *cl) { static clock_t curr_time = 0; curr_time += dt; if (dt > 0 && ft_clock_to_ms(curr_time) > 1000.0) { ft_sprintf(cl->fps_count, "fps: %ld", (uint32_t)CLOCKS_PER_SEC / dt); curr_time -= CLOCKS_PER_SEC; } }