mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
feat: rotation via deltatime + fix deltatime calculation
This commit is contained in:
parent
11ea82f935
commit
770f3d5ec0
3 changed files with 29 additions and 24 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue