aboutsummaryrefslogtreecommitdiff
path: root/src/hu_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/hu_lib.h')
-rw-r--r--src/hu_lib.h247
1 files changed, 247 insertions, 0 deletions
diff --git a/src/hu_lib.h b/src/hu_lib.h
new file mode 100644
index 0000000..db17572
--- /dev/null
+++ b/src/hu_lib.h
@@ -0,0 +1,247 @@
1/* Emacs style mode select -*- C++ -*-
2 *-----------------------------------------------------------------------------
3 *
4 *
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
11 * Copyright 2005, 2006 by
12 * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 * 02111-1307, USA.
28 *
29 * DESCRIPTION: none
30 *
31 *-----------------------------------------------------------------------------*/
32
33#ifndef __HULIB__
34#define __HULIB__
35
36// We are referring to patches.
37#include "r_defs.h"
38#include "v_video.h" //jff 2/16/52 include color range defs
39
40
41/* background and foreground screen numbers
42 * different from other modules. */
43#define BG 1
44#define FG 0
45
46/* font stuff
47 * #define HU_CHARERASE KEYD_BACKSPACE / not used / phares
48 */
49
50#define HU_MAXLINES 4
51#define HU_MAXLINELENGTH 80
52#define HU_REFRESHSPACING 8 /*jff 2/26/98 space lines in text refresh widget*/
53/*jff 2/26/98 maximum number of messages allowed in refresh list */
54#define HU_MAXMESSAGES 16
55
56/*
57 * Typedefs of widgets
58 */
59
60/* Text Line widget
61 * (parent of Scrolling Text and Input Text widgets) */
62typedef struct
63{
64 // left-justified position of scrolling text window
65 int x;
66 int y;
67
68 const patchnum_t* f; // font
69 int sc; // start character
70 //const char *cr; //jff 2/16/52 output color range
71 // Proff - Made this an int again. Needed for OpenGL
72 int cm; //jff 2/16/52 output color range
73
74 // killough 1/23/98: Support multiple lines:
75 #define MAXLINES 25
76
77 int linelen;
78 char l[HU_MAXLINELENGTH*MAXLINES+1]; // line of text
79 int len; // current line length
80
81 // whether this line needs to be udpated
82 int needsupdate;
83
84} hu_textline_t;
85
86
87
88// Scrolling Text window widget
89// (child of Text Line widget)
90typedef struct
91{
92 hu_textline_t l[HU_MAXLINES]; // text lines to draw
93 int h; // height in lines
94 int cl; // current line number
95
96 // pointer to boolean stating whether to update window
97 boolean* on;
98 boolean laston; // last value of *->on.
99
100} hu_stext_t;
101
102//jff 2/26/98 new widget to display last hud_msg_lines of messages
103// Message refresh window widget
104typedef struct
105{
106 hu_textline_t l[HU_MAXMESSAGES]; // text lines to draw
107 int nl; // height in lines
108 int nr; // total height in rows
109 int cl; // current line number
110
111 int x,y,w,h; // window position and size
112 const patchnum_t *bg; // patches for background
113
114 // pointer to boolean stating whether to update window
115 boolean* on;
116 boolean laston; // last value of *->on.
117
118} hu_mtext_t;
119
120
121
122// Input Text Line widget
123// (child of Text Line widget)
124typedef struct
125{
126 hu_textline_t l; // text line to input on
127
128 // left margin past which I am not to delete characters
129 int lm;
130
131 // pointer to boolean stating whether to update window
132 boolean* on;
133 boolean laston; // last value of *->on;
134
135} hu_itext_t;
136
137
138//
139// Widget creation, access, and update routines
140//
141
142//
143// textline code
144//
145
146// clear a line of text
147void HUlib_clearTextLine(hu_textline_t *t);
148
149void HUlib_initTextLine
150(
151 hu_textline_t *t,
152 int x,
153 int y,
154 const patchnum_t *f,
155 int sc,
156 int cm //jff 2/16/98 add color range parameter
157);
158
159// returns success
160boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch);
161
162// draws tline
163void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor);
164
165// erases text line
166void HUlib_eraseTextLine(hu_textline_t *l);
167
168
169//
170// Scrolling Text window widget routines
171//
172
173// initialize an stext widget
174void HUlib_initSText
175( hu_stext_t* s,
176 int x,
177 int y,
178 int h,
179 const patchnum_t* font,
180 int startchar,
181 int cm, //jff 2/16/98 add color range parameter
182 boolean* on );
183
184// add a text message to an stext widget
185void HUlib_addMessageToSText(hu_stext_t* s, const char* prefix, const char* msg);
186
187// draws stext
188void HUlib_drawSText(hu_stext_t* s);
189
190// erases all stext lines
191void HUlib_eraseSText(hu_stext_t* s);
192
193//jff 2/26/98 message refresh widget
194// initialize refresh text widget
195void HUlib_initMText(hu_mtext_t *m, int x, int y, int w, int h, const patchnum_t* font,
196 int startchar, int cm, const patchnum_t* bgfont, boolean *on);
197
198//jff 2/26/98 message refresh widget
199// add a text message to refresh text widget
200void HUlib_addMessageToMText(hu_mtext_t* m, const char* prefix, const char* msg);
201
202//jff 2/26/98 new routine to display a background on which
203// the list of last hud_msg_lines are displayed
204void HUlib_drawMBg
205( int x,
206 int y,
207 int w,
208 int h,
209 const patchnum_t* bgp
210);
211
212//jff 2/26/98 message refresh widget
213// draws mtext
214void HUlib_drawMText(hu_mtext_t* m);
215
216//jff 4/28/98 erases behind message list
217void HUlib_eraseMText(hu_mtext_t* m);
218
219// Input Text Line widget routines
220void HUlib_initIText
221( hu_itext_t* it,
222 int x,
223 int y,
224 const patchnum_t* font,
225 int startchar,
226 int cm, //jff 2/16/98 add color range parameter
227 boolean* on );
228
229// resets line and left margin
230void HUlib_resetIText(hu_itext_t* it);
231
232// left of left-margin
233void HUlib_addPrefixToIText
234( hu_itext_t* it,
235 char* str );
236
237// whether eaten
238boolean HUlib_keyInIText
239( hu_itext_t* it,
240 unsigned char ch );
241
242void HUlib_drawIText(hu_itext_t* it);
243
244// erases all itext lines
245void HUlib_eraseIText(hu_itext_t* it);
246
247#endif