Index

ncurses-minesweeper / f003c49

Terminal game of Minesweeper, implemented in C with ncurses.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
1612 Sep 2020 18:46f003c49Move page headers into pages.hJosh Stockin113G

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

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