Index

ncurses-minesweeper / 5a2607d

Terminal game of Minesweeper, implemented in C with ncurses.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
1212 Sep 2020 16:199e98a79Create game loop and page structureJosh Stockin1310G

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

text/plain523 bytesdownload raw
1#include <ncurses.h>
2
3#include "../state.h"
4
5#include "text.h"
6#include "title.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 default:
20 return 1;
21 }
22 refresh();
23 return ret;
24}
25
26void draw_loop(game_state *state) {
27 int ch = 0;
28 while ((ch = getch())) {
29 if (draw(state, ch)) break;
30 }
31}
32