【发布时间】:2012-05-16 06:15:54
【问题描述】:
我想制作一个带有ncurses.h 和不止一种颜色的菜单。
我的意思是这样的:
┌────────────────────┐
│░░░░░░░░░░░░░░░░░░░░│ <- color 1
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ <- color 2
└────────────────────┘
但是如果我使用init_pair()、attron()和attroff(),整个屏幕的颜色是一样的,而不是像我预期的那样。
initscr();
init_pair(0, COLOR_BLACK, COLOR_RED);
init_pair(1, COLOR_BLACK, COLOR_GREEN);
attron(0);
printw("This should be printed in black with a red background!\n");
refresh();
attron(1);
printw("And this in a green background!\n");
refresh()
sleep(2);
endwin();
这段代码有什么问题?
感谢您的每一个回答!
【问题讨论】:
标签: c command-line window ncurses