2 * Curses UI for slide puzzle game
3 * Copyright © 2022 Nick Bowler
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 #ifndef RRACE_CURSESUI_H_
20 #define RRACE_CURSESUI_H_
24 /* Array indices for gamewin and goalwin window sets. */
32 /* Colour pair enumeration */
34 /* Pairs 1-6 correspond to tile colours; use TILE_xxx enumerations. */
35 RR_COLOUR_SHADOW = TILE_MAX, /* black on black (use bold) */
36 RR_COLOUR_TOOLBAR, /* cyan on black (use reverse video) */
43 WINDOW *gamewin[PLAYWIN_MAX], *goalwin[PLAYWIN_MAX];
44 WINDOW *toolbar, *timer;
46 /* Previous input returned from getch, for 2-character sequences */
49 /* Most recently displayed timer value, for screen redraw. */
50 uint_least32_t timer_ms;
52 /* Location of the keyboard cursor */
55 /* If true, the goal will be displayed over the main play area. */
56 uint_least8_t view_goal_on_game;
58 /* Clicked toolbar item */
59 uint_least8_t toolbar_click;
61 /* Current state of the toolbar menu */
62 uint_least8_t toolbar_state;
65 void curs_new_game(struct app_state *state);
67 void curs_reenable_dialog(struct app_state *state, const char *heading);
69 void curs_draw_toolbar(struct app_state *state);
70 void curs_execute_function(struct app_state *state, int function);
72 #if HAVE_CURSES_MOUSE_SUPPORT
73 int curs_toolbar_mouse_func(struct app_state *state, int x, int y);
76 curs_toolbar_mouse_func(struct app_state *state, int x, int y)
82 #define MIN(a, b) ((a) < (b) ? (a) : (b))
83 #define MAX(a, b) ((a) > (b) ? (a) : (b))