Moved curses initialization related stuff to display.c.

This commit is contained in:
Murilo Soares Pereira 2010-04-03 15:26:21 -03:00
parent 042b45f36a
commit 1910bfe868
2 changed files with 10 additions and 6 deletions

View File

@ -1,9 +1,18 @@
#include <ncurses.h>
#include <malloc.h>
#include <string.h>
#include <locale.h>
#include "card.h"
#include "display.h"
void init_curses() {
setlocale(LC_ALL, ""); /* 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 */
}
char *card_suit(enum suit suit) {
char *card_suit;

View File

@ -1,7 +1,6 @@
#include <ncurses.h>
#include <malloc.h>
#include <string.h>
#include <locale.h>
#include "common.h"
#include "../lib/card.h"
@ -9,11 +8,7 @@ int main(int argc, const char *argv[]) {
char message[] = "Welcome to tty-solitaire.";
int row_number, column_number;
setlocale(LC_ALL, ""); /* 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 */
init_curses();
getmaxyx(stdscr, row_number, column_number);
mvprintw(row_number / 2 - 1,