Started working on color support
This commit is contained in:
26
test.c
26
test.c
@@ -3,13 +3,21 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
int curs_init();
|
||||
void color_init();
|
||||
int curs_end(ITEM* item);
|
||||
|
||||
int main() {
|
||||
|
||||
curs_init();
|
||||
|
||||
init_color();
|
||||
color_init(); /* If the program doesn't exit after this function call, it is
|
||||
assumed that the terminal supports colors */
|
||||
|
||||
|
||||
init_pair(1,COLOR_BLACK,COLOR_WHITE);
|
||||
|
||||
|
||||
|
||||
mousemask(BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED,NULL);
|
||||
MEVENT event;
|
||||
int c;
|
||||
@@ -35,6 +43,8 @@ int main() {
|
||||
|
||||
WINDOW* subwindow = derwin(stdscr,1,maxx-1,0,0);
|
||||
|
||||
wbkgd(subwindow,COLOR_PAIR(1));
|
||||
|
||||
keypad(subwindow,TRUE);
|
||||
|
||||
set_menu_sub(menu,subwindow);
|
||||
@@ -94,6 +104,20 @@ int curs_init() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void color_init() {
|
||||
|
||||
if (has_colors() == FALSE) {
|
||||
endwin();
|
||||
printf("Your terminal does not support colors.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
start_color();
|
||||
|
||||
}
|
||||
|
||||
|
||||
int curs_end(ITEM* item) {
|
||||
endwin();
|
||||
printf("You selected %s\n",item_name(item));
|
||||
|
Reference in New Issue
Block a user