fix: Changed the fps counter, switched from a DMA to a static memory allocation

This commit is contained in:
Theo Champion 2025-08-20 15:32:57 +02:00
parent 9ec4a33fc8
commit 4a2b4eb287

View file

@ -37,7 +37,7 @@ int game_loop(t_cub3d_data *data)
{
t_ray ray;
int fps;
char *fps_string;
char fps_string[4];
data->last_tick = get_milliseconds();
reset_matrix(data);
@ -52,10 +52,9 @@ int game_loop(t_cub3d_data *data)
mlx_string_put(data->mlx, data->mlx_win, 10, 10, 0x00FFFFFF, COMPILED_TEXT);
data->delta = (get_milliseconds() - data->last_tick);
fps = 1000000.0 / data->delta;
fps_string = ft_itoa(fps);
ft_itoa_static(fps, fps_string, 4);
mlx_string_put(data->mlx, data->mlx_win, WIDTH - 20, 15, 0xFF0000,
fps_string);
free(fps_string);
return (0);
}