aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsutane <atsutane@freethoughts.de>2009-05-05 18:39:26 +0200
committerAtsutane <atsutane@freethoughts.de>2009-05-05 18:39:26 +0200
commit8b856cae1fe70fb9663bbc80d9720d184792828e (patch)
treedbdc523ab5ee26d555998da9e69cf692fe703a78
parentbc9f55bad11b045466b853dc7e90526cd15d46fa (diff)
downloadpong-8b856cae1fe70fb9663bbc80d9720d184792828e.tar.gz
pong-8b856cae1fe70fb9663bbc80d9720d184792828e.tar.bz2
main(): Initialize ncurses and start a game.
-rw-r--r--src/pong.c17
1 files changed, 17 insertions, 0 deletions
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;
}