-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.c
95 lines (86 loc) · 1.87 KB
/
utils.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nahmed-m <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/01/02 20:23:07 by nahmed-m #+# #+# */
/* Updated: 2016/01/14 11:59:04 by nahmed-m ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
void ft_exit(char *error)
{
ft_putendl_fd(error, 2);
exit(0);
}
void ft_print_2d_tab(int **tab, int line, int collum)
{
int i;
int j;
i = 0;
while (i != line)
{
j = 0;
while (j != collum)
{
ft_putnbr(tab[i][j]);
ft_putstr(" ");
j++;
}
ft_putstr("\n");
i++;
}
}
void ft_modify_tab(t_env *control, int ratio)
{
int i;
int j;
i = 0;
while (i != control->line)
{
j = 0;
while (j != control->collum)
{
if (ratio == 1)
control->cor[i][j] *= 1.5;
if (ratio == 0)
control->cor[i][j] /= 1.5;
j++;
}
i++;
}
}
int color(int i)
{
if (i <= 0)
return (BLUE);
else if (i <= 2)
return (YELLOW);
else if (i <= 30)
return (GREEN);
else if (i <= 40)
return (TURQ);
else if (i <= 50)
return (BROWN);
else
return (WHITE);
}
void ft_black_screen(t_env *map)
{
int x;
int y;
x = 0;
y = 0;
while (y <= Y_WIN)
{
while (x <= X_WIN)
{
mlx_pixel_put(map->mlx, map->win, x, y, 0x000000);
x++;
}
y++;
x = 0;
}
}