-
Notifications
You must be signed in to change notification settings - Fork 2
/
input.c
67 lines (53 loc) · 1.07 KB
/
input.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
#include <ncurses.h>
#include "input.h"
#include "data.h"
#include "layout.h"
static int x_pos = 0;
static int y_pos = 0;
static int x_real = 4;
static int y_real = 4;
void draw_input() {
}
void parse_input() {
char ch;
int max_x, max_y;
getmaxyx(curscr, max_y, max_x);
while ((ch = getch()) != '\n') {
if (ch == '\033') {
getch();
int real = getch();
if (real == 'A') { //up
if (y_pos == y_start) {
//shift
if (y_start != 0)
draw_axes(y_start - 1, x);
//draw cursor
move(x_real, y_real);
attron(COLOR_PAIR(2));
} else {
attroff(COLOR_PAIR(2));
for (int i = 0; i < draw_size; i++) {
printw(" ");
}
move(x_real, y_real)
}
} else if (real == 'B') { //down
if (y_pos - y_start + 4 >= max_y) {
//shift
} else {
}
} else if (real == 'C') { //right
if ( ((x_pos - x_start) * draw_size) + 3 ) {
//shift
} else {
}
} else if (real == 'D') { //left
if (x_pos == x_start) {
//shift
} else {
}
}
} else {
}
}
}