1 /* 2 * Copyright (C) 2003 Robert Kooima 3 * 4 * NEVERBALL is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published 6 * by the Free Software Foundation; either version 2 of the License, 7 * or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, but 10 * WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * General Public License for more details. 13 */ 14 15 #ifndef GUI_H 16 #define GUI_H 17 18 #include "glext.h" 19 #include "video.h" 20 21 /*---------------------------------------------------------------------------*/ 22 23 #define GUI_FACE "ttf/DejaVuSans-Bold.ttf" 24 25 #define GUI_SML 0 26 #define GUI_MED 1 27 #define GUI_LRG 2 28 29 /* Sides */ 30 31 #define GUI_N 1 32 #define GUI_E 2 33 #define GUI_S 4 34 #define GUI_W 8 35 36 /* Corners */ 37 38 #define GUI_NW (GUI_N | GUI_W) 39 #define GUI_SW (GUI_S | GUI_W) 40 #define GUI_NE (GUI_N | GUI_E) 41 #define GUI_SE (GUI_S | GUI_E) 42 43 /* Multiple corners */ 44 45 #define GUI_LFT (GUI_NW | GUI_SW) 46 #define GUI_RGT (GUI_NE | GUI_SE) 47 #define GUI_TOP (GUI_NW | GUI_NE) 48 #define GUI_BOT (GUI_SW | GUI_SE) 49 #define GUI_ALL (GUI_TOP | GUI_BOT) 50 51 extern const GLubyte gui_wht[4]; 52 extern const GLubyte gui_yel[4]; 53 extern const GLubyte gui_red[4]; 54 extern const GLubyte gui_blu[4]; 55 extern const GLubyte gui_grn[4]; 56 extern const GLubyte gui_blk[4]; 57 extern const GLubyte gui_gry[4]; 58 59 enum trunc 60 { 61 TRUNC_NONE, 62 TRUNC_HEAD, 63 TRUNC_TAIL 64 }; 65 66 /*---------------------------------------------------------------------------*/ 67 68 void gui_init(void); 69 void gui_free(void); 70 71 /*---------------------------------------------------------------------------*/ 72 73 void gui_set_label(int, const char *); 74 void gui_set_image(int, const char *); 75 void gui_set_font(int, const char *); 76 void gui_set_multi(int, const char *); 77 void gui_set_count(int, int); 78 void gui_set_clock(int, int); 79 void gui_set_color(int, const GLubyte *, const GLubyte *); 80 void gui_set_trunc(int, enum trunc); 81 void gui_set_fill(int); 82 int gui_set_state(int, int, int); 83 void gui_set_hilite(int, int); 84 void gui_set_rect(int, int); 85 void gui_set_cursor(int); 86 87 /*---------------------------------------------------------------------------*/ 88 89 int gui_harray(int); 90 int gui_varray(int); 91 int gui_hstack(int); 92 int gui_vstack(int); 93 int gui_filler(int); 94 95 int gui_image(int, const char *, int, int); 96 int gui_start(int, const char *, int, int, int); 97 int gui_state(int, const char *, int, int, int); 98 int gui_label(int, const char *, int, const GLubyte *, const GLubyte *); 99 int gui_multi(int, const char *, int, const GLubyte *, const GLubyte *); 100 int gui_count(int, int, int); 101 int gui_clock(int, int, int); 102 int gui_space(int); 103 104 /*---------------------------------------------------------------------------*/ 105 106 void gui_dump(int, int); 107 void gui_layout(int, int, int); 108 int gui_search(int, int, int); 109 int gui_delete(int); 110 111 /*---------------------------------------------------------------------------*/ 112 113 void gui_paint(int); 114 void gui_pulse(int, float); 115 void gui_timer(int, float); 116 int gui_point(int, int, int); 117 int gui_stick(int, int, float, int); 118 int gui_click(int, int); 119 void gui_focus(int); 120 121 int gui_active(void); 122 int gui_token(int); 123 int gui_value(int); 124 void gui_toggle(int); 125 126 /*---------------------------------------------------------------------------*/ 127 128 /* 129 * Reserved GUI tokens. (Mostly Neverball specific.) 130 */ 131 132 enum 133 { 134 GUI_NONE = 0, 135 136 GUI_BACK, 137 GUI_PREV, 138 GUI_NEXT, 139 GUI_BS, 140 GUI_CL, 141 GUI_CHAR, 142 GUI_NAME, 143 GUI_SCORE, 144 145 GUI_LAST 146 }; 147 148 int gui_navig(int id, int total, int first, int step); 149 int gui_maybe(int, const char *, int, int, int); 150 151 /*---------------------------------------------------------------------------*/ 152 153 struct size 154 { 155 int w, h; 156 }; 157 158 struct size gui_measure(const char *text, int size); 159 160 /*---------------------------------------------------------------------------*/ 161 162 #endif 163