gnl integre au main

This commit is contained in:
hugogogo
2021-07-24 11:57:54 +02:00
parent 0c4e4419c7
commit 0bf59a09b9
192 changed files with 6157 additions and 10 deletions

View File

@@ -25,7 +25,7 @@ t_fdf *init_fdf(t_fdf *fdf)
fdf->img_size_x = fdf->win_size_x;
fdf->img_size_y = fdf->win_size_y;
fdf->rot_x = -30;
fdf->rot_y = -45;
fdf->rot_y = -60;
fdf->mov_x = 0;
fdf->mov_y = 0;
fdf->zoom = -5;
@@ -44,14 +44,31 @@ int main(int ac, char **av)
{
t_fdf *fdf;
if (ac != 1)
return (0);
fdf = malloc(sizeof(t_fdf));
fdf->map = parse_map(fdf, av);
fdf = init_fdf(fdf);
mlx_hook(fdf->win_ptr, 2, 1L << 0, keypress, fdf);
mlx_hook(fdf->win_ptr, 17, 1L << 17, shut_down, fdf);
mlx_loop(fdf->mlx_ptr);
if (ac == 1)
{
fdf = malloc(sizeof(t_fdf));
fdf->map = parse_map(fdf, av);
fdf = init_fdf(fdf);
mlx_hook(fdf->win_ptr, 2, 1L << 0, keypress, fdf);
mlx_hook(fdf->win_ptr, 17, 1L << 17, shut_down, fdf);
mlx_loop(fdf->mlx_ptr);
}
if (ac == 2)
{
int fd;
int ret;
char *line;
ret = 1;
line = NULL;
fd = open(av[1], O_RDONLY);
while (ret > 0)
{
ret = ft_gnl(fd, &line);
ft_printf("%s\n", line);
free(line);
}
}
return (0);
}