====== CMatrix ====== * [[http://www.asty.org/cmatrix/|CMatrix 主页]] * [[http://sourceforge.net/project/?group_id=4055|源码所在]] * 这是个模拟《骇客帝国》里屏幕绿色字符飘泊而下的程序, 很是酷炫,在 ubuntu 下可安装sudo apt-get install cmatrix然后直接命令行执行''cmatrix''. * 看源码, 是使用了 Linux/Unix 下的一个图形库 [[https://en.wikipedia.org/wiki/Curses_%28programming_library%29|curses]], curses的名字源于"cursor optimization". ===== curses ===== * 使用curses, ubuntu 一般默认安装了链接库, 但头文件还要安装开发库: sudo apt-get install libncurses5-dev * 下面是个示例程序, 我在 ubuntu 14.04 虚拟机上可编译执行: #include #include #include int main() {   initscr();   /* We move the cursor to the point (5,15) on the logical screen,   print "Hello World" and refresh the actual screen.   Lastly, we use the call sleep(2) to suspend the program for two seconds,   so we can see the output before the program ends. */   move(5, 15);   printw("%s", "Hello World");   refresh();   sleep(2);   endwin();   exit(EXIT_SUCCESS); } 使用 gcc 编译 gcc -o screen1 screen1.c -lcurses