2010-04-13 01:07:00 -03:00
|
|
|
#include <stdlib.h>
|
2011-02-12 13:56:31 -02:00
|
|
|
#include <ncurses.h>
|
2011-02-06 21:28:11 -02:00
|
|
|
#include "util.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "keyboard.h"
|
2010-03-31 02:21:17 -03:00
|
|
|
|
2011-02-06 03:44:45 -02:00
|
|
|
const char *program_name;
|
|
|
|
|
|
|
|
int main(int argc, const char *argv[]) {
|
|
|
|
program_name = *argv;
|
2011-02-06 00:32:21 -02:00
|
|
|
int key;
|
2010-04-13 01:07:00 -03:00
|
|
|
|
2010-04-12 02:56:28 -03:00
|
|
|
initialize_curses();
|
2010-04-13 01:07:00 -03:00
|
|
|
greet_player();
|
|
|
|
|
2011-02-06 00:32:21 -02:00
|
|
|
while (key != KEY_SPACEBAR) {
|
|
|
|
switch (key = getch()) {
|
2011-02-06 04:14:17 -02:00
|
|
|
case KEY_SPACEBAR:
|
|
|
|
initialize_game();
|
|
|
|
break;
|
|
|
|
case 'q':
|
|
|
|
case 'Q':
|
|
|
|
end_curses();
|
|
|
|
exit(0);
|
2010-04-13 01:07:00 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
while (1) {
|
2011-02-06 00:32:21 -02:00
|
|
|
if ((key = getch()) == 'q' || key == 'Q') {
|
|
|
|
end_curses();
|
2011-02-09 23:50:24 -02:00
|
|
|
end_game();
|
2011-02-06 00:32:21 -02:00
|
|
|
exit(0);
|
|
|
|
} else {
|
|
|
|
handle_keyboard_event(key);
|
2010-04-20 01:10:42 -03:00
|
|
|
}
|
2010-04-13 01:07:00 -03:00
|
|
|
}
|
2010-04-03 00:32:19 -03:00
|
|
|
|
2010-04-12 02:56:28 -03:00
|
|
|
return(0);
|
2010-03-31 02:21:17 -03:00
|
|
|
}
|