-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.c
69 lines (57 loc) · 1.41 KB
/
test.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
#include "tm.h"
#include <stdlib.h>
// Demonstrating DEC box drawing characters
// Unicode characters can be used but they're not likely to be supported
// Universally, I believe.
char *boxc[] = {
TM_DEC "\x6c" TM_DECE, TM_DEC "\x6b" TM_DECE, TM_DEC "\x6d" TM_DECE, TM_DEC "\x6a" TM_DECE,
TM_DEC "\x71" TM_DECE, TM_DEC "\x78" TM_DECE
};
void box(unsigned int x, unsigned int y, unsigned int w, unsigned int h)
{
tm_setxy(x,y);
fputs(boxc[0], stdout);
for(int i = 0; i < w - 2; ++i)
fputs(boxc[4], stdout);
fputs(boxc[1], stdout);
tm_setxy(x, y + h - 1);
fputs(boxc[2], stdout);
for(int i = 0; i < w - 2; ++i)
fputs(boxc[4], stdout);
fputs(boxc[3], stdout);
tm_setxy(x, y + 1);
for(int i = 0; i < h - 1; ++i)
{
fputs(boxc[5], stdout);
tm_setxy(x, y + 1 + i);
}
tm_setxy(x + w - 1, y + 1);
for(int i = 0; i < h - 1; ++i)
{
fputs(boxc[5], stdout);
tm_setxy(x + w - 1, y + 1 + i);
}
}
int main()
{
int w, h;
tm_init();
tm_cls();
tm_setcv(0);
tm_setxy(0,0);
printf("Hello.");
tm_setxy(10,2);
printf("Hi");
tm_setxy(8,7);
tm_getwh(&w, &h);
printf("width:%d height:%d", w, h);
tm_setcan(0);
tm_setecho( 0);
box(6, 5, w-10, h-10);
getchar();
tm_cls();
tm_setxy(0,0);
tm_reset();
tm_setcv(1);
return 0;
}