-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_draw_field.c
66 lines (63 loc) · 1.7 KB
/
ft_draw_field.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_draw_field.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: komatsud <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/01 09:45:03 by komatsud #+# #+# */
/* Updated: 2023/07/02 11:45:50 by komatsud ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_connect4.h"
//fix later
int ft_draw_field(t_info *t_maps)
{
size_t y;
size_t x;
size_t i;
y = 1;
x = 1;
ft_printf("\n");
while (x <= t_maps->col)
{
if (x <= 9)
ft_printf(" ");
ft_printf("%d", x);
x ++;
}
ft_printf("\n");
while (y < t_maps->row + 1)
{
x = 1;
i = 1;
while (i < t_maps->col + 1)
{
ft_printf("-");
i ++;
}
ft_printf("\n");
while (x < t_maps->col + 1)
{
ft_printf(GREY"|"RESET_COLOR);
if (t_maps->maps[y][x] == '0')
ft_printf(" ");
else if (t_maps->maps[y][x] == '1')
ft_printf(GREEN"●"RESET_COLOR);
else if (t_maps->maps[y][x] == '2')
ft_printf(RED"◆"RESET_COLOR);
x ++;
}
ft_printf(GREY"|"RESET_COLOR);
ft_printf("\n");
y ++;
}
i = 1;
while (i < t_maps->col + 1)
{
ft_printf("-");
i ++;
}
ft_printf("\n\n");
return (0);
}