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 |
|
12 | int 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 |
|
32 | void draw_loop(game_state *state) { |
33 | int ch = 0; |
34 | while ((ch = getch())) { |
35 | if (draw(state, ch)) break; |
36 | } |
37 | } |
38 |
|