diff options
| author | Atsutane <atsutane@freethoughts.de> | 2009-05-05 18:39:26 +0200 |
|---|---|---|
| committer | Atsutane <atsutane@freethoughts.de> | 2009-05-05 18:39:26 +0200 |
| commit | 8b856cae1fe70fb9663bbc80d9720d184792828e (patch) | |
| tree | dbdc523ab5ee26d555998da9e69cf692fe703a78 /src/pong.c | |
| parent | bc9f55bad11b045466b853dc7e90526cd15d46fa (diff) | |
| download | pong-8b856cae1fe70fb9663bbc80d9720d184792828e.tar.gz pong-8b856cae1fe70fb9663bbc80d9720d184792828e.tar.bz2 | |
main(): Initialize ncurses and start a game.
Diffstat (limited to 'src/pong.c')
| -rw-r--r-- | src/pong.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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; } |
