Debian Codegraph @

prboom2/src/st_lib.h

raw
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
53 typedef 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 dboolean stating
70 // whether to update number
71 dboolean* 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.)
82 typedef 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
92 typedef 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 dboolean stating
105 // whether to update icon
106 dboolean* 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 //
117 // Widget creation, access, and update routines
118 //
119
120 // Initializes widget library.
121 // More precisely, initialize STMINUS,
122 // everything else is done somewhere else.
123 //
124 void STlib_init(void);
125
126 // Number widget routines
127 void STlib_initNum
128 ( st_number_t* n,
129 int x,
130 int y,
131 const patchnum_t* pl,
132 int* num,
133 dboolean* on,
134 int width );
135
136 void STlib_updateNum
137 ( st_number_t* n,
138 int cm,
139 dboolean refresh );
140
141
142 // Percent widget routines
143 void STlib_initPercent
144 ( st_percent_t* p,
145 int x,
146 int y,
147 const patchnum_t* pl,
148 int* num,
149 dboolean* on,
150 const patchnum_t* percent );
151
152
153 void STlib_updatePercent
154 ( st_percent_t* per,
155 int cm,
156 int refresh );
157
158
159 // Multiple Icon widget routines
160 void STlib_initMultIcon
161 ( st_multicon_t* mi,
162 int x,
163 int y,
164 const patchnum_t* il,
165 int* inum,
166 dboolean* on );
167
168
169 void STlib_updateMultIcon
170 ( st_multicon_t* mi,
171 dboolean refresh );
172
173 #endif