pinosaur
/
taskasaur.git
/ blob
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
ncurses basics
[taskasaur.git]
/
main.cpp
1
#include <ncurses.h>
2
using namespace std;
3
4
int main(int argc, char ** argv) {
5
6
initscr();
7
cbreak();
8
/* raw(); */
9
noecho();
10
11
WINDOW * win = newwin(10,20,10,10);
12
13
refresh();
14
15
int x, y;
16
x = y = 0;
17
18
while (true) {
19
int ch = getch();
20
21
//ofc the first thing we need is vim keys
22
switch (ch) {
23
case 104: // h
24
x -= 1;
25
break;
26
case 106: // j
27
y += 1;
28
break;
29
case 107: // k
30
y -= 1;
31
break;
32
case 108: // l
33
x += 1;
34
break;
35
}
36
if (ch == 113) break; // q for quit
37
38
move(y,x);
39
40
box(win, 0, 0);
41
mvwprintw(win, 0, 1, "lmao");
42
wrefresh(win);
43
44
refresh();
45
/* clear(); */
46
}
47
48
endwin();
49
50
return 0;
51
}
52
53