aboutsummaryrefslogtreecommitdiff
path: root/src/st_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/st_lib.h')
-rw-r--r--src/st_lib.h209
1 files changed, 209 insertions, 0 deletions
diff --git a/src/st_lib.h b/src/st_lib.h
new file mode 100644
index 0000000..769a75e
--- /dev/null
+++ b/src/st_lib.h
@@ -0,0 +1,209 @@
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:
30 * The status bar widget definitions and prototypes
31 *
32 *-----------------------------------------------------------------------------*/
33
34#ifndef __STLIB__
35#define __STLIB__
36
37// We are referring to patches.
38#include "r_defs.h"
39#include "v_video.h" // color ranges
40
41//
42// Background and foreground screen numbers
43//
44#define BG 4
45#define FG 0
46
47//
48// Typedefs of widgets
49//
50
51// Number widget
52
53typedef struct
54{
55 // upper right-hand corner
56 // of the number (right-justified)
57 int x;
58 int y;
59
60 // max # of digits in number
61 int width;
62
63 // last number value
64 int oldnum;
65
66 // pointer to current value
67 int* num;
68
69 // pointer to boolean stating
70 // whether to update number
71 boolean* on;
72
73 // list of patches for 0-9
74 const patchnum_t* p;
75
76 // user data
77 int data;
78} st_number_t;
79
80// Percent widget ("child" of number widget,
81// or, more precisely, contains a number widget.)
82typedef struct
83{
84 // number information
85 st_number_t n;
86
87 // percent sign graphic
88 const patchnum_t* p;
89} st_percent_t;
90
91// Multiple Icon widget
92typedef struct
93{
94 // center-justified location of icons
95 int x;
96 int y;
97
98 // last icon number
99 int oldinum;
100
101 // pointer to current icon
102 int* inum;
103
104 // pointer to boolean stating
105 // whether to update icon
106 boolean* on;
107
108 // list of icons
109 const patchnum_t* p;
110
111 // user data
112 int data;
113
114} st_multicon_t;
115
116// Binary Icon widget
117
118typedef struct
119{
120 // center-justified location of icon
121 int x;
122 int y;
123
124 // last icon value
125 boolean oldval;
126
127 // pointer to current icon status
128 boolean* val;
129
130 // pointer to boolean
131 // stating whether to update icon
132 boolean* on;
133
134 const patchnum_t* p; // icon
135 int data; // user data
136} st_binicon_t;
137
138//
139// Widget creation, access, and update routines
140//
141
142// Initializes widget library.
143// More precisely, initialize STMINUS,
144// everything else is done somewhere else.
145//
146void STlib_init(void);
147
148// Number widget routines
149void STlib_initNum
150( st_number_t* n,
151 int x,
152 int y,
153 const patchnum_t* pl,
154 int* num,
155 boolean* on,
156 int width );
157
158void STlib_updateNum
159( st_number_t* n,
160 int cm,
161 boolean refresh );
162
163
164// Percent widget routines
165void STlib_initPercent
166( st_percent_t* p,
167 int x,
168 int y,
169 const patchnum_t* pl,
170 int* num,
171 boolean* on,
172 const patchnum_t* percent );
173
174
175void STlib_updatePercent
176( st_percent_t* per,
177 int cm,
178 int refresh );
179
180
181// Multiple Icon widget routines
182void STlib_initMultIcon
183( st_multicon_t* mi,
184 int x,
185 int y,
186 const patchnum_t* il,
187 int* inum,
188 boolean* on );
189
190
191void STlib_updateMultIcon
192( st_multicon_t* mi,
193 boolean refresh );
194
195// Binary Icon widget routines
196
197void STlib_initBinIcon
198( st_binicon_t* b,
199 int x,
200 int y,
201 const patchnum_t* i,
202 boolean* val,
203 boolean* on );
204
205void STlib_updateBinIcon
206( st_binicon_t* bi,
207 boolean refresh );
208
209#endif