fix: various rendering issues

- Correct rendering on whole window if window is not square
- Multiple crashes eliminated
- Sprites no longer lag behind player movement/rotation
This commit is contained in:
Khaïs COLIN 2025-08-12 12:21:56 +02:00
parent 98e0119c91
commit fcb08f6447
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
4 changed files with 9 additions and 11 deletions

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
/* Updated: 2025/08/11 11:03:22 by tchampio ### ########.fr */
/* Updated: 2025/08/12 14:23:27 by kcolin ### ########.fr */
/* */
/* ************************************************************************** */
@ -39,11 +39,9 @@ int game_loop(t_cub3d_data *data)
char *fps_string;
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);
raycaster(data, &ray);
move_player(data);
raycaster(data, &ray);
sprite_caster(data);
matrix_to_image(data);
draw_map(data->map, &data->player, data->img_data);