2011-02-06 06:33:59 +00:00
|
|
|
#include <stdio.h>
|
2010-04-13 02:42:21 +00:00
|
|
|
#include <ncurses.h>
|
|
|
|
#include <locale.h>
|
2011-05-08 23:38:36 +00:00
|
|
|
#include "curses.h"
|
2010-04-13 02:42:21 +00:00
|
|
|
|
|
|
|
void initialize_curses() {
|
2011-05-31 05:40:53 +00:00
|
|
|
setlocale(LC_ALL, "en_US.utf-8"); /* Support unicode characters. */
|
|
|
|
initscr();
|
|
|
|
raw(); /* Disable line buffers. */
|
|
|
|
noecho();
|
|
|
|
keypad(stdscr, TRUE); /* Enable arrow keys. */
|
|
|
|
start_color(); /* I want colors. */
|
|
|
|
curs_set(FALSE); /* Invisible cursor. */
|
|
|
|
set_escdelay(0);
|
2010-04-13 04:07:00 +00:00
|
|
|
assume_default_colors(COLOR_WHITE, COLOR_GREEN);
|
2010-04-13 02:42:21 +00:00
|
|
|
|
|
|
|
init_pair(1, COLOR_BLACK, COLOR_WHITE);
|
|
|
|
init_pair(2, COLOR_RED, COLOR_WHITE);
|
|
|
|
init_pair(3, COLOR_WHITE, COLOR_BLUE);
|
2010-04-21 07:14:39 +00:00
|
|
|
init_pair(4, COLOR_WHITE, COLOR_GREEN);
|
2010-04-13 02:42:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void end_curses() {
|
|
|
|
endwin();
|
|
|
|
puts("Game finished.");
|
|
|
|
}
|
2010-04-13 04:07:00 +00:00
|
|
|
|
|
|
|
void clear_screen() {
|
|
|
|
clear();
|
|
|
|
refresh();
|
|
|
|
}
|