style: use constants for window width and height

This commit is contained in:
Khaïs COLIN 2025-07-22 12:48:44 +02:00
parent 6aecc3ba6e
commit 7449450c52
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */ /* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */ /* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
/* Updated: 2025/07/21 11:50:30 by kcolin ### ########.fr */ /* Updated: 2025/07/22 12:50:14 by kcolin ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -35,7 +35,7 @@ int game_loop(t_cub3d_data *data)
data->player.x += data->player.movement.x; data->player.x += data->player.movement.x;
data->player.y += data->player.movement.y; data->player.y += data->player.movement.y;
mlx_destroy_image(data->mlx, data->img_data->img); mlx_destroy_image(data->mlx, data->img_data->img);
data->img_data->img = mlx_new_image(data->mlx, 800, 600); data->img_data->img = mlx_new_image(data->mlx, WIDTH, HEIGHT);
draw_map(data->map, &data->player, data->img_data); draw_map(data->map, &data->player, data->img_data);
mlx_put_image_to_window(data->mlx, data->mlx_win, mlx_put_image_to_window(data->mlx, data->mlx_win,
data->img_data->img, 0, 0); data->img_data->img, 0, 0);
@ -57,9 +57,9 @@ int main(int argc, char **argv)
if (data.mlx == NULL) if (data.mlx == NULL)
return (ft_printf("Error: Failed to initalize mlx\n"), return (ft_printf("Error: Failed to initalize mlx\n"),
free_map(data.map), 1); free_map(data.map), 1);
data.mlx_win = mlx_new_window(data.mlx, 800, 600, "Cub3d"); data.mlx_win = mlx_new_window(data.mlx, WIDTH, HEIGHT, "Cub3d");
data.img_data = ft_calloc(sizeof(t_img_data), 1); data.img_data = ft_calloc(sizeof(t_img_data), 1);
data.img_data->img = mlx_new_image(data.mlx, 800, 600); data.img_data->img = mlx_new_image(data.mlx, WIDTH, HEIGHT);
data.img_data->addr = mlx_get_data_addr(data.img_data->img, data.img_data->addr = mlx_get_data_addr(data.img_data->img,
&data.img_data->bits_per_pixel, &data.img_data->line_length, &data.img_data->bits_per_pixel, &data.img_data->line_length,
&data.img_data->endian); &data.img_data->endian);