Index

ncurses-minesweeper / 48085a2

Terminal game of Minesweeper, implemented in C with ncurses.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
4817 Oct 2021 18:26c10793dUpdate repository endpoint in comment blocksJosh Stockin111G

Blob @ ncurses-minesweeper / src / draw / about.c

text/plain1564 bytesdownload raw
1/* ncurses-minesweeper Copyright (c) 2021 Joshua 'joshuas3' Stockin
2 * <https://joshstock.in>
3 * <https://git.joshstock.in/ncurses-minesweeper>
4 *
5 * This software is licensed and distributed under the terms of the MIT License.
6 * See the MIT License in the LICENSE file of this project's root folder.
7 *
8 * This comment block and its contents, including this disclaimer, MUST be
9 * preserved in all copies or distributions of this software's source.
10 */
11
12#include <ncurses.h>
13
14#include "../state.h"
15#include "../strings.h"
16#include "pages.h"
17#include "text.h"
18
19int draw_about_screen(game_state *state, int ch) {
20 // input handling
21 switch (ch) {
22 case -1:
23 return 0;
24 case KEY_RESIZE:
25 clear();
26 break;
27 case KEY_ENTER: {
28 clear();
29 state->page = Title;
30 return draw_title_screen(state, 0);
31 break;
32 }
33 case 0:
34 break;
35 default:
36 beep();
37 }
38
39 // draw help screen
40 int top = centery() - 3;
41 if (top < 0) top = 0;
42
43 attron(A_BOLD | COLOR_PAIR(2));
44 mvaddstr(top, centerx(about_screen_title), about_screen_title);
45 attroff(A_BOLD);
46
47 mvaddstr(top + 2, centerx(copyright_line), copyright_line);
48 mvaddstr(top + 3, centerx(about_website_source), about_website_source);
49 mvaddstr(top + 4, centerx(about_website_home), about_website_home);
50
51 attron(A_STANDOUT);
52 mvaddstr(top + 6, centerx(about_screen_back), about_screen_back);
53 attroff(A_STANDOUT | COLOR_PAIR(2));
54
55 return 0;
56}
57