|
Odamex
Setting the Standard in Multiplayer Doom
|
00001 // Emacs style mode select -*- C++ -*- 00002 //----------------------------------------------------------------------------- 00003 // 00004 // $Id: st_lib.h 1788 2010-08-24 04:42:57Z russellrice $ 00005 // 00006 // Copyright (C) 1993-1996 by id Software, Inc. 00007 // Copyright (C) 2006-2010 by The Odamex Team. 00008 // 00009 // This program is free software; you can redistribute it and/or 00010 // modify it under the terms of the GNU General Public License 00011 // as published by the Free Software Foundation; either version 2 00012 // of the License, or (at your option) any later version. 00013 // 00014 // This program is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // DESCRIPTION: 00020 // The status bar widget code. 00021 // 00022 //----------------------------------------------------------------------------- 00023 00024 00025 #ifndef __STLIB__ 00026 #define __STLIB__ 00027 00028 00029 // We are referring to patches. 00030 #include "r_defs.h" 00031 00032 00033 // 00034 // Background and foreground screen numbers 00035 // 00036 // [RH] Status bar is another screen allocated 00037 // by status bar code instead of video code. 00038 extern DCanvas *stbarscreen; 00039 extern DCanvas *stnumscreen; 00040 #define BG (stbarscreen) 00041 #define FG (screen) 00042 00043 00044 00045 // 00046 // Typedefs of widgets 00047 // 00048 00049 // Number widget 00050 00051 struct st_number_s 00052 { 00053 // upper right-hand corner 00054 // of the number (right-justified) 00055 int x; 00056 int y; 00057 00058 // max # of digits in number 00059 int width; 00060 00061 // last number value 00062 int oldnum; 00063 00064 // pointer to current value 00065 int* num; 00066 00067 // pointer to bool stating 00068 // whether to update number 00069 bool* on; 00070 00071 // list of patches for 0-9 00072 patch_t** p; 00073 00074 // user data 00075 int data; 00076 00077 }; 00078 typedef struct st_number_s st_number_t; 00079 00080 00081 00082 // Percent widget ("child" of number widget, 00083 // or, more precisely, contains a number widget.) 00084 struct st_percent_s 00085 { 00086 // number information 00087 st_number_t n; 00088 00089 // percent sign graphic 00090 patch_t* p; 00091 00092 }; 00093 typedef struct st_percent_s st_percent_t; 00094 00095 00096 // Multiple Icon widget 00097 struct st_multicon_s 00098 { 00099 // center-justified location of icons 00100 int x; 00101 int y; 00102 00103 // last icon number 00104 int oldinum; 00105 00106 // pointer to current icon 00107 int* inum; 00108 00109 // pointer to bool stating 00110 // whether to update icon 00111 bool* on; 00112 00113 // list of icons 00114 patch_t** p; 00115 00116 // user data 00117 int data; 00118 00119 }; 00120 typedef struct st_multicon_s st_multicon_t; 00121 00122 00123 00124 // Binary Icon widget 00125 00126 struct st_binicon_s 00127 { 00128 // center-justified location of icon 00129 int x; 00130 int y; 00131 00132 // last icon value 00133 bool oldval; 00134 00135 // pointer to current icon status 00136 bool* val; 00137 00138 // pointer to bool 00139 // stating whether to update icon 00140 bool* on; 00141 00142 00143 patch_t* p; // icon 00144 int data; // user data 00145 00146 }; 00147 typedef struct st_binicon_s st_binicon_t; 00148 00149 00150 // 00151 // Widget creation, access, and update routines 00152 // 00153 00154 // Initializes widget library. 00155 // More precisely, initialize STMINUS, 00156 // everything else is done somewhere else. 00157 // 00158 void STlib_init(void); 00159 00160 00161 00162 // Number widget routines 00163 void 00164 STlib_initNum 00165 ( st_number_t* n, 00166 int x, 00167 int y, 00168 patch_t** pl, 00169 int* num, 00170 bool* on, 00171 int width ); 00172 00173 void 00174 STlib_updateNum 00175 ( st_number_t* n, 00176 bool refresh ); 00177 00178 00179 // Percent widget routines 00180 void 00181 STlib_initPercent 00182 ( st_percent_t* p, 00183 int x, 00184 int y, 00185 patch_t** pl, 00186 int* num, 00187 bool* on, 00188 patch_t* percent ); 00189 00190 00191 void 00192 STlib_updatePercent 00193 ( st_percent_t* per, 00194 bool refresh ); 00195 00196 00197 // Multiple Icon widget routines 00198 void 00199 STlib_initMultIcon 00200 ( st_multicon_t* mi, 00201 int x, 00202 int y, 00203 patch_t** il, 00204 int* inum, 00205 bool* on ); 00206 00207 00208 void 00209 STlib_updateMultIcon 00210 ( st_multicon_t* mi, 00211 bool refresh ); 00212 00213 // Binary Icon widget routines 00214 void 00215 STlib_initBinIcon 00216 ( st_binicon_t* b, 00217 int x, 00218 int y, 00219 patch_t* i, 00220 bool* val, 00221 bool* on ); 00222 00223 void 00224 STlib_updateBinIcon 00225 ( st_binicon_t* bi, 00226 bool refresh ); 00227 00228 #endif 00229