-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
43 lines (34 loc) · 752 Bytes
/
main.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
#include "vbuf.h"
#include "w.h"
#include <stdio.h>
#include <stdlib.h>
#include "s.h"
#include "tty.h"
#include "kbd.h"
#include "defs.h"
#include <unistd.h>
struct SCRN scrn;
void terminalAtExit()
{
scrn_free(&scrn);
}
int main()
{
scrn = scrn_init();
if (ttyGetWindowSize(&scrn.height, &scrn.width) == -1) {
perror("Cannot get terminal window size.");
exit(0);
}
//ttyEnableRawMode();
struct WIN win = {scrn.width, scrn.height, 0, 0, 0, 1, 0};
wins_append(&scrn.wins, win);
scrn.pWin = &scrn.wins.wins[0];
scrn.cx = scrn.pWin->cx + scrn.pWin->cx;
scrn.cy = scrn.pWin->cy + scrn.pWin->cy;
while (1)
{
scrn_update(&scrn);
kbdProcKey(&scrn);
}
return 0;
}