From e63eed3b92febb61f0e830b7b6e3c656f3e36091 Mon Sep 17 00:00:00 2001 From: djonker Date: Thu, 26 Oct 2023 20:38:39 +0200 Subject: [PATCH] added FPS counter --- src/draw.c | 2 +- src/main.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/draw.c b/src/draw.c index 37b11ab..a26d8eb 100644 --- a/src/draw.c +++ b/src/draw.c @@ -6,7 +6,7 @@ /* By: houtworm +#+ */ /* +#+ */ /* Created: 2023/10/26 16:54:20 by houtworm #+# #+# */ -/* Updated: 2023/10/26 16:54:33 by houtworm ######## odam.nl */ +/* Updated: 2023/10/26 20:38:07 by houtworm ######## odam.nl */ /* */ /* ************************************************************************** */ diff --git a/src/main.c b/src/main.c index a9077f6..48e60de 100644 --- a/src/main.c +++ b/src/main.c @@ -6,11 +6,12 @@ /* By: houtworm +#+ */ /* +#+ */ /* Created: 2023/10/26 14:13:07 by houtworm #+# #+# */ -/* Updated: 2023/10/26 17:39:01 by houtworm ######## odam.nl */ +/* Updated: 2023/10/26 20:37:00 by houtworm ######## odam.nl */ /* */ /* ************************************************************************** */ #include "../cub3d.h" +#include void mainloop(void *param) { @@ -21,9 +22,12 @@ void mainloop(void *param) vl->img = mlx_new_image(vl->mlx, vl->w, vl->h); ft_movementkeys(vl); ft_drawnextframe(vl); + ft_putnbr(1 / vl->mlx->delta_time); + ft_putendl(" FPS"); + ft_putendl(" "); if (!vl->img || (mlx_image_to_window(vl->mlx, vl->img, 0, 0) < 0)) ft_errorexit("image to window failed ", "mainloop", 1); - ft_putendl("frame"); + /*ft_putendl("frame");*/ } int main(int argc, char **argv)