diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-17 17:15:32 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-17 17:15:32 +0100 |
commit | 05ad2085ab6ce4ffb280b21ce3f321b2bd75aa9e (patch) | |
tree | c6c521c8f2ad8df4477005b8225427b7459daf32 /src/ft_key_loop.c | |
parent | Merge branch 'back-to-pthread' (diff) | |
download | 42-cub3d-05ad2085ab6ce4ffb280b21ce3f321b2bd75aa9e.tar.gz 42-cub3d-05ad2085ab6ce4ffb280b21ce3f321b2bd75aa9e.tar.bz2 42-cub3d-05ad2085ab6ce4ffb280b21ce3f321b2bd75aa9e.tar.xz 42-cub3d-05ad2085ab6ce4ffb280b21ce3f321b2bd75aa9e.tar.zst 42-cub3d-05ad2085ab6ce4ffb280b21ce3f321b2bd75aa9e.zip |
fps counter is bav
Diffstat (limited to 'src/ft_key_loop.c')
-rw-r--r-- | src/ft_key_loop.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ft_key_loop.c b/src/ft_key_loop.c index 74ff775..0108202 100644 --- a/src/ft_key_loop.c +++ b/src/ft_key_loop.c @@ -13,8 +13,9 @@ #include <libft.h> #include <cub3d.h> #include <mlx.h> -#include <stdint.h> #include <stddef.h> +#include <stdint.h> +#include <time.h> static uint64_t ft_find_x(int32_t key, const t_player *pl) @@ -77,7 +78,9 @@ int uint8_t i; const float old_y = cl->plist.pos_y; const float old_x = cl->plist.pos_x; + clock_t begin_frame; + begin_frame = clock(); i = 0; while (i < 5 && cl->key_input[i] != -1 && cl->key_input[i] <= 5) { @@ -100,5 +103,6 @@ int i++; } ft_draw_scene(cl); + ft_get_fps_count(clock() - begin_frame, cl); return (0); } |