31 lines
1011 B
C
31 lines
1011 B
C
#include <stdio.h>
|
|
#include <ncurses.h>
|
|
#include <locale.h>
|
|
#include "curses.h"
|
|
|
|
void initialize_curses() {
|
|
setlocale(LC_ALL, "en_US.utf-8"); /* supporting unicode characters */
|
|
initscr(); /* initialize the terminal in curses mode */
|
|
raw(); /* disable line buffers */
|
|
noecho(); /* character echo is unnecessary */
|
|
keypad(stdscr, TRUE); /* enable F and arrow keys */
|
|
start_color(); /* I want colors */
|
|
curs_set(FALSE); /* invisible cursor */
|
|
assume_default_colors(COLOR_WHITE, COLOR_GREEN);
|
|
|
|
init_pair(1, COLOR_BLACK, COLOR_WHITE);
|
|
init_pair(2, COLOR_RED, COLOR_WHITE);
|
|
init_pair(3, COLOR_WHITE, COLOR_BLUE);
|
|
init_pair(4, COLOR_WHITE, COLOR_GREEN);
|
|
}
|
|
|
|
void end_curses() {
|
|
endwin();
|
|
puts("Game finished.");
|
|
}
|
|
|
|
void clear_screen() {
|
|
clear();
|
|
refresh();
|
|
}
|