added FPS counter

This commit is contained in:
djonker 2023-10-26 20:38:39 +02:00
parent e23417a33c
commit e63eed3b92
2 changed files with 7 additions and 3 deletions

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */ /* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */ /* +#+ */
/* Created: 2023/10/26 16:54:20 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View File

@ -6,11 +6,12 @@
/* By: houtworm <codam@houtworm.net> +#+ */ /* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */ /* +#+ */
/* Created: 2023/10/26 14:13:07 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 "../cub3d.h"
#include <stdio.h>
void mainloop(void *param) void mainloop(void *param)
{ {
@ -21,9 +22,12 @@ void mainloop(void *param)
vl->img = mlx_new_image(vl->mlx, vl->w, vl->h); vl->img = mlx_new_image(vl->mlx, vl->w, vl->h);
ft_movementkeys(vl); ft_movementkeys(vl);
ft_drawnextframe(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)) if (!vl->img || (mlx_image_to_window(vl->mlx, vl->img, 0, 0) < 0))
ft_errorexit("image to window failed ", "mainloop", 1); ft_errorexit("image to window failed ", "mainloop", 1);
ft_putendl("frame"); /*ft_putendl("frame");*/
} }
int main(int argc, char **argv) int main(int argc, char **argv)