-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
47 lines (43 loc) · 1.51 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* ************************************************************************** */
/* */
/* :::::::: */
/* main.c :+: :+: */
/* +:+ */
/* By: jvan-hal <[email protected]> +#+ */
/* +#+ */
/* Created: 2023/01/27 10:55:36 by jvan-hal #+# #+# */
/* Updated: 2023/03/02 10:59:32 by jvan-hal ######## odam.nl */
/* */
/* ************************************************************************** */
#include<unistd.h>
#include<stdlib.h>
#include"fdf.h"
// static void checkleaks()
// {
// system("leaks fdf");
// }
int main(int argc, char **argv)
{
t_fdf *fdf;
if (argc == 1 || argc > 2)
{
if (argc == 1)
write(2, "no input file specified\n", 24);
else
write(2, "too many arguments\n", 19);
return (1);
}
fdf = (t_fdf *)ft_calloc(1, sizeof(t_fdf));
if (!fdf)
return (1);
get_input(argv[1], fdf);
fdf->mlx = mlx_init(1000, 800, "FDF", true);
if (!fdf->mlx)
return (free_fdf(fdf));
start_fdf(fdf);
mlx_image_to_window(fdf->mlx, fdf->img[0], fdf->ox, fdf->oy);
draw_legend(fdf);
hooks(fdf);
free_fdf(fdf);
return (0);
}