-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdraw_tab.c
86 lines (78 loc) · 1.67 KB
/
draw_tab.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* draw_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: eleclet <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/01/30 21:29:50 by eleclet #+# #+# */
/* Updated: 2016/01/31 22:22:06 by eleclet ### ########.fr */
/* */
/* ************************************************************************** */
#include "game.h"
int set(void)
{
if (COLS / 2 > LINES)
return (LINES * 0.9);
else
return (COLS / 2.1);
}
void line(int origin, int len, int dir)
{
int i;
i = 0;
if (dir == 0)
{
while (i < len)
{
mvaddch(i, origin, '#');
i++;
}
}
if (dir == 1)
{
while (i < len)
{
mvaddch(origin, i, '#');
i++;
}
}
}
void setnu(int i, int tab[i][i])
{
int x;
int y;
x = 0;
y = 0;
while (x < i)
{
while (y < i)
{
pr(x * set() / i + 1, y * set() * 2 / i + 1,
tab[x][y]);
y++;
}
y = 0;
x++;
}
refresh();
}
void msquare(int j, int i)
{
int w;
int p;
w = j * 2;
p = 1;
curs_set(FALSE);
line(0, j, 0);
line(w, j, 0);
line(0, w, 1);
line(j - 1, w, 1);
while (p < i)
{
line(set() * 2 * p / i, set(), 0);
line(set() * p / i, w, 1);
p++;
}
refresh();
}