-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_check.c
61 lines (56 loc) · 1.7 KB
/
ft_check.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_check.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zrabhi <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/09 10:30:41 by zrabhi #+# #+# */
/* Updated: 2022/04/10 01:50:42 by zrabhi ### ########.fr */
/* */
/* ************************************************************************** */
#include "fractol.h"
int closed(t_fractol *data)
{
(void)data;
mlx_destroy_image(data->mlx, data->img.img);
mlx_destroy_window(data->mlx, data->mlx_wind);
free(data);
exit(0);
}
int ft_strcmp(const char *s1, const char *s2)
{
size_t i;
i = 0;
while (s1[i] && s2[i] && s1[i] == s2[i])
i++;
return (((unsigned char *)s1)[i] - ((unsigned char *)s2)[i]);
}
int ft_check(char **av, t_fractol *data)
{
if (ft_strcmp("-m", av[1]) == 0)
{
data->value = 0;
ft_draw(data, &mandelbrote);
return (1);
}
else if (ft_strcmp("-j", av[1]) == 0)
{
data->value = 1;
julia_data(data);
ft_draw(data, &julia);
return (1);
}
else if (ft_strcmp("-b", av[1]) == 0)
{
data->value = 2;
ft_draw(data, &burningship);
return (1);
}
else
{
purple();
ft_putstr("\n Invalid fractol, Use a correct one\n\n");
}
return (0);
}