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 | 20 | 0 | G |
1 | #include <ncurses.h> |
2 | #include <string.h> |
3 | |
4 | int centerx(char* txt) { |
5 | size_t ln = strlen(txt); |
6 | int x = (int)(COLS/2) - (int)(ln/2); |
7 | return x; |
8 | } |
9 | |
10 | int centery() { |
11 | int y = (int)(LINES/2); |
12 | return y; |
13 | } |
14 | |
15 | void flushright(int line, char* txt) { |
16 | size_t ln = strlen(txt); |
17 | int x = COLS - 1 - ln; |
18 | mvprintw(line, x, txt); |
19 | move(0,0); |
20 | } |
21 |