Fix red, moved around a bit to much.
[kugel-rb.git] / apps / plugins / doom / hu_lib.h
blob76d26bbb0f349c5f7118b843acf96bd72b8d5a98
1 /* Emacs style mode select -*- C++ -*-
2 *-----------------------------------------------------------------------------
5 * PrBoom a Doom port merged with LxDoom and LSDLDoom
6 * based on BOOM, a modified and improved DOOM engine
7 * Copyright (C) 1999 by
8 * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
9 * Copyright (C) 1999-2000 by
10 * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 * 02111-1307, USA.
27 * DESCRIPTION: none
29 *-----------------------------------------------------------------------------*/
31 #ifndef __HULIB__
32 #define __HULIB__
34 // We are referring to patches.
35 #include "r_defs.h"
36 #include "v_video.h" //jff 2/16/52 include color range defs
39 /* background and foreground screen numbers
40 * different from other modules. */
41 #define BG 1
42 #define FG 0
44 /* font stuff
45 * #define HU_CHARERASE KEYD_BACKSPACE / not used / phares
48 #define HU_MAXLINES 4
49 #define HU_MAXLINELENGTH 80
50 #define HU_REFRESHSPACING 8 /*jff 2/26/98 space lines in text refresh widget*/
51 /*jff 2/26/98 maximum number of messages allowed in refresh list */
52 #define HU_MAXMESSAGES 16
55 * Typedefs of widgets
58 /* Text Line widget
59 * (parent of Scrolling Text and Input Text widgets) */
60 typedef struct
62 // left-justified position of scrolling text window
63 int x;
64 int y;
66 const patchnum_t* f; // font
67 int sc; // start character
68 //const char *cr; //jff 2/16/52 output color range
69 // Proff - Made this an int again. Needed for OpenGL
70 int cm; //jff 2/16/52 output color range
72 // killough 1/23/98: Support multiple lines:
73 #define MAXLINES 25
75 int linelen;
76 char l[HU_MAXLINELENGTH*MAXLINES+1]; // line of text
77 int len; // current line length
79 // whether this line needs to be udpated
80 int needsupdate;
82 } hu_textline_t;
86 // Scrolling Text window widget
87 // (child of Text Line widget)
88 typedef struct
90 hu_textline_t l[HU_MAXLINES]; // text lines to draw
91 int h; // height in lines
92 int cl; // current line number
94 // pointer to boolean stating whether to update window
95 boolean* on;
96 boolean laston; // last value of *->on.
98 } hu_stext_t;
100 //jff 2/26/98 new widget to display last hud_msg_lines of messages
101 // Message refresh window widget
102 typedef struct
104 hu_textline_t l[HU_MAXMESSAGES]; // text lines to draw
105 int nl; // height in lines
106 int nr; // total height in rows
107 int cl; // current line number
109 int x,y,w,h; // window position and size
110 const patchnum_t *bg; // patches for background
112 // pointer to boolean stating whether to update window
113 boolean* on;
114 boolean laston; // last value of *->on.
116 } hu_mtext_t;
120 // Input Text Line widget
121 // (child of Text Line widget)
122 typedef struct
124 hu_textline_t l; // text line to input on
126 // left margin past which I am not to delete characters
127 int lm;
129 // pointer to boolean stating whether to update window
130 boolean* on;
131 boolean laston; // last value of *->on;
133 } hu_itext_t;
137 // Widget creation, access, and update routines
140 // initializes heads-up widget library
141 void HUlib_init(void);
144 // textline code
147 // clear a line of text
148 void HUlib_clearTextLine(hu_textline_t *t);
150 void HUlib_initTextLine
152 hu_textline_t *t,
153 int x,
154 int y,
155 const patchnum_t *f,
156 int sc,
157 int cm //jff 2/16/98 add color range parameter
160 // returns success
161 boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch);
163 // returns success
164 boolean HUlib_delCharFromTextLine(hu_textline_t *t);
166 // draws tline
167 void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor);
169 // erases text line
170 void HUlib_eraseTextLine(hu_textline_t *l);
174 // Scrolling Text window widget routines
177 // initialize an stext widget
178 void HUlib_initSText
179 ( hu_stext_t* s,
180 int x,
181 int y,
182 int h,
183 const patchnum_t* font,
184 int startchar,
185 int cm, //jff 2/16/98 add color range parameter
186 boolean* on );
188 // add a new line
189 void HUlib_addLineToSText(hu_stext_t* s);
191 // add a text message to an stext widget
192 void HUlib_addMessageToSText(hu_stext_t* s, const char* prefix, const char* msg);
194 // draws stext
195 void HUlib_drawSText(hu_stext_t* s);
197 // erases all stext lines
198 void HUlib_eraseSText(hu_stext_t* s);
200 //jff 2/26/98 message refresh widget
201 // initialize refresh text widget
202 void HUlib_initMText(hu_mtext_t *m, int x, int y, int w, int h, const patchnum_t* font,
203 int startchar, int cm, const patchnum_t* bgfont, boolean *on);
205 //jff 2/26/98 message refresh widget
206 // add a text line to refresh text widget
207 void HUlib_addLineToMText( hu_mtext_t* m );
209 //jff 2/26/98 message refresh widget
210 // add a text message to refresh text widget
211 void HUlib_addMessageToMText(hu_mtext_t* m, const char* prefix, const char* msg);
213 //jff 2/26/98 new routine to display a background on which
214 // the list of last hud_msg_lines are displayed
215 void HUlib_drawMBg
216 ( int x,
217 int y,
218 int w,
219 int h,
220 const patchnum_t* bgp
223 //jff 2/26/98 message refresh widget
224 // draws mtext
225 void HUlib_drawMText(hu_mtext_t* m);
227 //jff 4/28/98 erases behind message list
228 void HUlib_eraseMText(hu_mtext_t* m);
230 // Input Text Line widget routines
231 void HUlib_initIText
232 ( hu_itext_t* it,
233 int x,
234 int y,
235 const patchnum_t* font,
236 int startchar,
237 int cm, //jff 2/16/98 add color range parameter
238 boolean* on );
240 // enforces left margin
241 void HUlib_delCharFromIText(hu_itext_t* it);
243 // enforces left margin
244 void HUlib_eraseLineFromIText(hu_itext_t* it);
246 // resets line and left margin
247 void HUlib_resetIText(hu_itext_t* it);
249 // left of left-margin
250 void HUlib_addPrefixToIText
251 ( hu_itext_t* it,
252 char* str );
254 // whether eaten
255 boolean HUlib_keyInIText
256 ( hu_itext_t* it,
257 unsigned char ch );
259 void HUlib_drawIText(hu_itext_t* it);
261 // erases all itext lines
262 void HUlib_eraseIText(hu_itext_t* it);
264 #endif