background.c

来自「ncurses 库 可能有用酒用 没用就算了 我觉得还可以用」· C语言 代码 · 共 69 行

C
69
字号
/* * $Id: background.c,v 1.1 2003/12/07 00:06:33 tom Exp $ */#include <test.priv.h>intmain(int argc GCC_UNUSED, char *argv[]GCC_UNUSED){    short f, b;    initscr();    cbreak();    noecho();    if (has_colors()) {	start_color();	pair_content(0, &f, &b);	printw("pair 0 contains (%d,%d)\n", f, b);	getch();	printw("Initializing pair 1 to red/black\n");	init_pair(1, COLOR_RED, COLOR_BLACK);	bkgdset(' ' | COLOR_PAIR(1));	printw("RED/BLACK\n");	getch();	printw("Initializing pair 2 to white/blue\n");	init_pair(2, COLOR_WHITE, COLOR_BLUE);	bkgdset(' ' | COLOR_PAIR(2));	printw("WHITE/BLUE\n");	getch();	printw("Resetting colors to pair 0\n");	bkgdset(' ' | COLOR_PAIR(0));	printw("Default Colors\n");	getch();	printw("Resetting colors to pair 1\n");	bkgdset(' ' | COLOR_PAIR(1));	printw("RED/BLACK\n");	getch();	printw("Setting screen to pair 0\n");	bkgd(' ' | COLOR_PAIR(0));	getch();	printw("Setting screen to pair 1\n");	bkgd(' ' | COLOR_PAIR(1));	getch();	printw("Setting screen to pair 2\n");	bkgd(' ' | COLOR_PAIR(2));	getch();	printw("Setting screen to pair 0\n");	bkgd(' ' | COLOR_PAIR(0));	getch();    } else {	printw("This demo requires a color terminal");	getch();    }    endwin();    ExitProgram(EXIT_SUCCESS);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?