-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui_ncs.c
46 lines (35 loc) · 829 Bytes
/
gui_ncs.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
#include "gui_ncs.h"
#include <ncurses.h>
void curses_init(){
initscr();
noecho();
raw();
curs_set(2);
start_color();
init_pair(1, COLOR_CYAN, COLOR_BLACK); /*COLOR codes for ncurses*/
init_pair(2, COLOR_GREEN, COLOR_BLACK);
init_pair(3, COLOR_WHITE, COLOR_BLACK);
}
/*Renders the window from the first line i.e. Y = 0, and the "start" buffer pointer.*/
void loadwin(buffer *bf, int y){
clear();
attron(COLOR_PAIR(3));
int x = 0;
while(bf != NULL){
mvprintw(y, x, "%s", bf->line);
y++;
bf = bf->next;
}
refresh();
}
/*not used, was initially supposed to put tildes on each line, but later discarded.*/
void tildeall(){
int x = 0, y = 0, ht;
getmaxyx(stdscr, ht, x);
x = 0;
for(y = 0; y < ht; y ++){
mvaddch(y, x, '~');
}
refresh();
move(0, 0);
}