-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmagic.c
76 lines (69 loc) · 1.87 KB
/
magic.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* magic.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dlenskyi <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/01/10 16:21:29 by dlenskyi #+# #+# */
/* Updated: 2019/01/10 16:21:31 by dlenskyi ### ########.fr */
/* */
/* ************************************************************************** */
#include "filler.h"
void magic_border(t_fill_gen *g, int color, int x, int y)
{
int i;
int j;
i = 0;
while (i < 9)
{
j = 0;
while (j < 9)
{
mlx_pixel_put(g->mlx.mlx_ptr, g->mlx.win_ptr,
25 + (x * 11) + j, 25 + (y * 11) + i, color);
j++;
}
i++;
}
}
void magic_start_pos(t_fill_gen *g)
{
int x;
int y;
y = 0;
while (g->map.size[y])
{
x = 0;
while (g->map.size[y][x])
{
if (g->map.size[y][x] == g->player.robot ||
g->map.size[y][x] == g->player.robot + 32)
magic_border(g, 0xeeff00, x, y);
else if (g->map.size[y][x] == g->player.human)
magic_border(g, 0xd500ff, x, y);
x++;
}
y++;
}
}
void magic_piece(t_fill_gen *g)
{
int x;
int y;
y = 0;
while (g->map.size[y])
{
x = 0;
while (g->map.size[y][x])
{
if (g->map.size[y][x] == g->player.robot ||
g->map.size[y][x] == g->player.robot + 32)
magic_border(g, 0xeeff00, x, y);
else if (g->map.size[y][x] == g->player.human)
magic_border(g, 0xd500ff, x, y);
x++;
}
y++;
}
}