mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
fix: Changed the fps counter, switched from a DMA to a static memory allocation
This commit is contained in:
parent
9ec4a33fc8
commit
4a2b4eb287
1 changed files with 2 additions and 3 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue