feat: rotation via deltatime + fix deltatime calculation

This commit is contained in:
Khaïs COLIN 2025-07-31 14:53:18 +02:00
parent 11ea82f935
commit 770f3d5ec0
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
3 changed files with 29 additions and 24 deletions

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
/* Updated: 2025/07/31 13:57:08 by tchampio ### ########.fr */
/* Updated: 2025/07/31 15:01:00 by kcolin ### ########.fr */
/* */
/* ************************************************************************** */
@ -33,7 +33,7 @@ int game_loop(t_cub3d_data *data)
{
t_ray ray;
data->delta = (get_milliseconds() - data->last_tick);
data->last_tick = get_milliseconds();
mlx_destroy_image(data->mlx, data->img_data->img);
data->img_data->img = mlx_new_image(data->mlx, WIDTH, HEIGHT);
reset_matrix(data);
@ -44,7 +44,8 @@ int game_loop(t_cub3d_data *data)
mlx_put_image_to_window(data->mlx, data->mlx_win,
data->img_data->img, 0, 0);
mlx_string_put(data->mlx, data->mlx_win, 10, 10, 0x00FFFFFF, COMPILED_TEXT);
data->last_tick = get_milliseconds();
data->delta = (get_milliseconds() - data->last_tick);
ft_printf("%d,%d\n", data->last_tick, data->delta);
return (0);
}