Terminal game of Minesweeper, implemented in C with ncurses.
| {#} | Time | Hash | Subject | Author | # | (+) | (-) | GPG? |
|---|---|---|---|---|---|---|---|---|
| 5 | 09 Sep 2020 21:11 | 2a7d780 | Update Makefile; begin program logic | Josh Stockin | 1 | 17 | 0 | G |
| 1 | #include <ncurses.h> |
| 2 | #include "text.h" |
| 3 | |
| 4 | int draw(int ch) { |
| 5 | if (ch == 'q' || ch == 'Q') return 1; // exit condition |
| 6 | clear(); |
| 7 | mvprintw(LINES-1, COLS-6, "%ix%i", COLS, LINES); |
| 8 | refresh(); |
| 9 | return 0; |
| 10 | } |
| 11 | |
| 12 | void draw_loop(void) { |
| 13 | int ch; |
| 14 | while ((ch = getch())) { |
| 15 | if (draw(ch)) break; |
| 16 | } |
| 17 | } |
| 18 |