]> git.lizzy.rs Git - plan9front.git/blob - sys/src/games/doom/st_lib.h
doom: port to amd64
[plan9front.git] / sys / src / games / doom / st_lib.h
1 // Emacs style mode select   -*- C++ -*- 
2 //-----------------------------------------------------------------------------
3 //
4 // $Id:$
5 //
6 // Copyright (C) 1993-1996 by id Software, Inc.
7 //
8 // This source is available for distribution and/or modification
9 // only under the terms of the DOOM Source Code License as
10 // published by id Software. All rights reserved.
11 //
12 // The source is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
15 // for more details.
16 //
17 // DESCRIPTION:
18 //      The status bar widget code.
19 //
20 //-----------------------------------------------------------------------------
21
22 #ifndef __STLIB__
23 #define __STLIB__
24
25
26 // We are referring to patches.
27 #include "r_defs.h"
28
29
30 //
31 // Background and foreground screen numbers
32 //
33 #define BG 4
34 #define FG 0
35
36
37
38 //
39 // Typedefs of widgets
40 //
41
42 // Number widget
43
44 typedef struct
45 {
46     // upper right-hand corner
47     //  of the number (right-justified)
48     int         x;
49     int         y;
50
51     // max # of digits in number
52     int width;    
53
54     // last number value
55     int         oldnum;
56     
57     // pointer to current value
58     int*        num;
59
60     // pointer to boolean stating
61     //  whether to update number
62     boolean*    on;
63
64     // list of patches for 0-9
65     patch_t**   p;
66
67     // user data
68     int data;
69     
70 } st_number_t;
71
72
73
74 // Percent widget ("child" of number widget,
75 //  or, more precisely, contains a number widget.)
76 typedef struct
77 {
78     // number information
79     st_number_t         n;
80
81     // percent sign graphic
82     patch_t*            p;
83     
84 } st_percent_t;
85
86
87
88 // Multiple Icon widget
89 typedef struct
90 {
91      // center-justified location of icons
92     int                 x;
93     int                 y;
94
95     // last icon number
96     int                 oldinum;
97
98     // pointer to current icon
99     int*                inum;
100
101     // pointer to boolean stating
102     //  whether to update icon
103     boolean*            on;
104
105     // list of icons
106     patch_t**           p;
107     
108     // user data
109     int                 data;
110     
111 } st_multicon_t;
112
113
114
115
116 // Binary Icon widget
117
118 typedef struct
119 {
120     // center-justified location of icon
121     int                 x;
122     int                 y;
123
124     // last icon value
125     int                 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
135     patch_t*            p;      // icon
136     int                 data;   // user data
137     
138 } st_binicon_t;
139
140
141
142 //
143 // Widget creation, access, and update routines
144 //
145
146 // Initializes widget library.
147 // More precisely, initialize STMINUS,
148 //  everything else is done somewhere else.
149 //
150 void STlib_init(void);
151
152
153
154 // Number widget routines
155 void
156 STlib_initNum
157 ( st_number_t*          n,
158   int                   x,
159   int                   y,
160   patch_t**             pl,
161   int*                  num,
162   boolean*              on,
163   int                   width );
164
165 void
166 STlib_updateNum
167 ( st_number_t*          n,
168   boolean               refresh );
169
170
171 // Percent widget routines
172 void
173 STlib_initPercent
174 ( st_percent_t*         p,
175   int                   x,
176   int                   y,
177   patch_t**             pl,
178   int*                  num,
179   boolean*              on,
180   patch_t*              percent );
181
182
183 void
184 STlib_updatePercent
185 ( st_percent_t*         per,
186   int                   refresh );
187
188
189 // Multiple Icon widget routines
190 void
191 STlib_initMultIcon
192 ( st_multicon_t*        mi,
193   int                   x,
194   int                   y,
195   patch_t**             il,
196   int*                  inum,
197   boolean*              on );
198
199
200 void
201 STlib_updateMultIcon
202 ( st_multicon_t*        mi,
203   boolean               refresh );
204
205 // Binary Icon widget routines
206
207 void
208 STlib_initBinIcon
209 ( st_binicon_t*         b,
210   int                   x,
211   int                   y,
212   patch_t*              i,
213   boolean*              val,
214   boolean*              on );
215
216 void
217 STlib_updateBinIcon
218 ( st_binicon_t*         bi,
219   boolean               refresh );
220
221 #endif
222 //-----------------------------------------------------------------------------
223 //
224 // $Log:$
225 //
226 //-----------------------------------------------------------------------------