Index

ncurses-minesweeper / bec4c7f

Terminal game of Minesweeper, implemented in C with ncurses.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
1512 Sep 2020 18:10bec4c7fCreate Help screenJosh Stockin171G

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

text/plain639 bytesdownload raw
1#include <ncurses.h>
2
3#include "../state.h"
4
5#include "text.h"
6#include "winsize.h"
7
8#include "help.h"
9#include "title.h"
10
11
12int draw(game_state *state, int ch) {
13 clear();
14 draw_winsize();
15 int ret = 0;
16 switch (state->page) {
17 case Title: {
18 ret = draw_title_screen(state, ch);
19 break;
20 }
21 case Help: {
22 ret = draw_help_screen(state, ch);
23 break;
24 }
25 default:
26 return 1;
27 }
28 refresh();
29 return ret;
30}
31
32void draw_loop(game_state *state) {
33 int ch = 0;
34 while ((ch = getch())) {
35 if (draw(state, ch)) break;
36 }
37}
38