-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnoodle.c
52 lines (45 loc) · 1.3 KB
/
noodle.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
#include "lib/aolib.h"
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
void api_closewin(int win);
void api_refreshwin(int win, int x0, int y0, int x1, int y1);
void api_boxfilwin(int win, int x0, int y0, int x1, int y1, int col);
void api_linewin(int win, int x0, int y0, int x1, int y1, int col);
void api_putstrwin(int win, int x, int y, int col, int len, char *str);
int api_getkey(int mode);
void api_initmalloc(void);
char *api_malloc(int size);
void api_free(char *addr, int size);
int api_alloctimer(void);
void api_inittimer(int timer, int data);
void api_settimer(int timer, int time);
void api_freetimer(int timer);
void api_end(void);
void HariMain(void)
{
char *buf, s[12];
int win, timer, sec = 0, min = 0, hou = 0;
api_initmalloc();
buf = api_malloc(150 * 50);
win = api_openwin(buf, 150, 50, -1, "noodle");
timer = api_alloctimer();
api_inittimer(timer, 128);
for (;;) {
sprintf(s, "%5d:%02d:%02d", hou, min, sec);
api_boxfilwin(win, 28, 27, 115, 41, 7 /* 白色 */);
api_putstrwin(win, 28, 27, 0 /* 黒色 */, 11, s);
api_settimer(timer, 100); /* 1秒間 */
if (api_getkey(1) != 128) {
break;
}
sec++;
if (sec == 60) {
sec = 0;
min++;
if (min == 60) {
min = 0;
hou++;
}
}
}
api_end();
}