-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdrawImp.c
79 lines (65 loc) · 1.71 KB
/
drawImp.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
/////////////////////////////////////////////////////////////////////////////////////////////////
// ∷¤★●※┗←↑↓→
//█▇▆▅▄▃▂▁○○◇ゅ□△▽☆★▼▲■◆●♀√×卍卐→◢▓ ¤〓╋━┃┏┓┗┛╭ ╭∩╮(︶︿︶)╭∩╮
/////////////////////////////////////////////////////////////////////////////////////////////////
#include "pcc32.h"
#define gotoLocation(x,y) gotoTextPos(x*2,y);
// #define drawString(x,y,color,string) gotoLocation(x,y); setTextColor(color); printf("%s",string);
//////////////////////////0////1///2////3////4////5///6////7/////8////9//
static char BLOCK[ ][3]={" ","■","¤","━","┃","┏","┓","┛","┗","☆"};
void drawString(int x,int y,PCCOLOR color,char* str)
{
if( (x<<1) > getLineWidth() ||
y > getLineNum() ||
x < 0 ||
y < 0 )
{
return;
}
gotoLocation(x,y);
setTextColor(color);
printf("%s",str);
}
void drawBlock(int x,int y,PCCOLOR color, int blockIndex )
{
if( (x<<1) > getLineWidth() ||
y > getLineNum() ||
x < 0 ||
y < 0 )
{
return;
}
gotoLocation(x,y);
setTextColor(color);
printf("%2s",BLOCK[blockIndex]);
}
void drawRectangle(const int _x, const int _y, const int width, const int height, PCCOLOR color)
{
int x = _x;
int y = _y;
drawBlock(x,y,color,5);
while( x < width + _x - 1 )
{
x++;
drawBlock(x,y,color,3);
}
drawBlock(x,y,color,6);
while( y < height + _y -1 )
{
y++;
drawBlock(x,y,color,4);
}
drawBlock(x,y,color,7);
while( x > _x )
{
x--;
drawBlock(x,y,color,3);
}
drawBlock(x,y,color,8);
while( y > _y + 1 )
{
y--;
drawBlock(x,y,color,4);
}
return;
}