-
Notifications
You must be signed in to change notification settings - Fork 1
/
Circle.c
64 lines (57 loc) · 1.48 KB
/
Circle.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
#include <stdio.h>
#include <string.h>
#include <curses.h>
#include "library.h"
// make
void makeCircle(char Circle[][CIR_MAX], int radius)
{
int i,j,u;
/*
for(i = 0; i < radius*2; i++)
for(j = 0 ; j < radius*2; j++)
if (radius * radius > (i+0.5-radius)*(i+0.5-radius) + (j+0.5-radius)*(j+0.5-radius) )
Circle[i][j] = '1';
else
Circle[i][j] = '0';*/
strcpy(Circle[0], "011110");
strcpy(Circle[1], "111111");
strcpy(Circle[2], "111111");
strcpy(Circle[3], "111111");
strcpy(Circle[4], "111111");
strcpy(Circle[5], "011110");
}
void printCircle(char Circle[][CIR_MAX], int x, int y, int Color)
{
int i, j;
for (i = 0; Circle[i][0] != '\0'; i++)
{
for (j = 0; Circle[i][j] != '\0'; j++)
{
//print color
if (Circle[i][j] == '1')
attron(COLOR_PAIR(Color));
else if (Circle[i][j] == '0')
attron(COLOR_PAIR(BACK_FAIR));
else
{
//turnoff color setting
attroff(COLOR_PAIR(FONT_FAIR));
attroff(COLOR_PAIR(BACK_FAIR));
}
//make a border
mvhline(y+i, x+j, ' ', 1);
}
}
refresh();
}
void deleteCircle(int x, int y)
{
int i;
attron(COLOR_PAIR(BACK_FAIR));
for (i = 0; i < CIR_SIZE*2; i++)
{
mvhline(y + i, x , ' ', CIR_SIZE*2);
}
attroff(COLOR_PAIR(BACK_FAIR));
refresh();
}