diff options
author | P. J. McDermott <pjm@nac.net> | 2011-12-13 01:39:48 (EST) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2011-12-13 01:39:48 (EST) |
commit | dda6afb4c523a4836bfa2a9effd73c35ff05102e (patch) | |
tree | 8d2bde29b6428bc0da9ee23dda2876f8de4e75e3 /src | |
parent | d60ba0002dc244a2b71e1c698ebeab1fac71b6a4 (diff) | |
download | cgol-dda6afb4c523a4836bfa2a9effd73c35ff05102e.zip cgol-dda6afb4c523a4836bfa2a9effd73c35ff05102e.tar.gz cgol-dda6afb4c523a4836bfa2a9effd73c35ff05102e.tar.bz2 |
Add a rudimentary main event loop.
At least one of the rules in tick() is wrong...
Diffstat (limited to 'src')
-rw-r--r-- | src/cgol.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -44,7 +44,7 @@ static bool *grid_cur, *grid_next; int main(int argc, char **argv) { - int opt; + int opt, c; width = 0; height = 0; @@ -84,7 +84,14 @@ main(int argc, char **argv) init_curses(); init_game(); - getch(); + timeout(1000); + for (;;) { + c = getch(); + if (c == 'q') { + break; + } + tick(); + } fini_game(); fini_curses(); |