From 8b856cae1fe70fb9663bbc80d9720d184792828e Mon Sep 17 00:00:00 2001 From: Atsutane Date: Tue, 5 May 2009 18:39:26 +0200 Subject: main(): Initialize ncurses and start a game. --- src/pong.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/pong.c b/src/pong.c index de92c91..1411f82 100644 --- a/src/pong.c +++ b/src/pong.c @@ -424,6 +424,23 @@ void quit(void) { int main(void) { + int winner, y, x; + + initscr(); /* start the WINDOW */ + atexit(quit); + clear(); /* Clear Terminal */ + noecho(); /* Don't echo input */ + nonl(); /* Receive \r instead of \n */ + curs_set(0); /* Set Cursor invisible */ + cbreak(); /* No line buffering */ + timeout(250); /* set input timeout to 250 milliseconds */ + keypad(stdscr, TRUE); /* Activate keypad */ + + winner = game(); + clear(); + getmaxyx(stdscr, y, x); + mvprintw(y/2, x/3, "Player %d wins.", winner); + getch(); return EXIT_SUCCESS; } -- cgit v1.2.3-70-g09d2