Terminal game of Minesweeper, implemented in C with ncurses.
{#} | Time | Hash | Subject | Author | # | (+) | (-) | GPG? |
---|---|---|---|---|---|---|---|---|
3 | 07 Sep 2020 19:42 | e64ff2f | Create Makefile and begin base program | Josh Stockin | 1 | 24 | 0 | G |
1 | #include <stdio.h> |
2 | #include <ncurses.h> |
3 | |
4 | int main(void) { |
5 | initscr(); |
6 | noecho(); |
7 | clear(); |
8 | |
9 | mvaddstr(0, 0, "Hello, World!"); |
10 | mvprintw(LINES-1, 0, "%d lines, %d rows", LINES, COLS); |
11 | |
12 | refresh(); |
13 | int c; |
14 | while ((c = getch())) { |
15 | move(LINES-2,0); |
16 | clrtoeol(); |
17 | mvprintw(LINES-2, 0, "%i", c); |
18 | if (c == 27 || c == 'q' || c == 'Q') { // 27 := <ESC> |
19 | endwin(); |
20 | break; |
21 | } |
22 | } |
23 | return 0; |
24 | } |
25 |