1 | #include <ncurses.h> |
2 |
|
3 | #include "../state.h" |
4 |
|
5 | #include "pages.h" |
6 | #include "text.h" |
7 | #include "winsize.h" |
8 |
|
9 |
|
10 | int 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 |
|
30 | void draw_loop(game_state *state) { |
31 | int ch = 0; |
32 | while ((ch = getch())) { |
33 | if (draw(state, ch)) break; |
34 | } |
35 | } |
36 |
|