DOOM-3-BFG

DOOM 3 BFG Edition
Log | Files | Refs

st_lib.h (4358B)


      1 /*
      2 ===========================================================================
      3 
      4 Doom 3 BFG Edition GPL Source Code
      5 Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. 
      6 
      7 This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").  
      8 
      9 Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
     10 it under the terms of the GNU General Public License as published by
     11 the Free Software Foundation, either version 3 of the License, or
     12 (at your option) any later version.
     13 
     14 Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
     15 but WITHOUT ANY WARRANTY; without even the implied warranty of
     16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17 GNU General Public License for more details.
     18 
     19 You should have received a copy of the GNU General Public License
     20 along with Doom 3 BFG Edition Source Code.  If not, see <http://www.gnu.org/licenses/>.
     21 
     22 In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code.  If not, please request a copy in writing from id Software at the address below.
     23 
     24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
     25 
     26 ===========================================================================
     27 */
     28 
     29 #ifndef __STLIB__
     30 #define __STLIB__
     31 
     32 
     33 // We are referring to patches.
     34 #include "r_defs.h"
     35 
     36 
     37 //
     38 // Background and foreground screen numbers
     39 //
     40 #define BG 4
     41 #define FG 0
     42 
     43 
     44 
     45 //
     46 // Typedefs of widgets
     47 //
     48 
     49 // Number widget
     50 
     51 typedef struct
     52 {
     53     // upper right-hand corner
     54     //  of the number (right-justified)
     55     int		x;
     56     int		y;
     57 
     58     // max # of digits in number
     59     int width;    
     60 
     61     // last number value
     62     int		oldnum;
     63     
     64     // pointer to current value
     65     int*	num;
     66 
     67     // pointer to qboolean stating
     68     //  whether to update number
     69     qboolean*	on;
     70 
     71     // list of patches for 0-9
     72     patch_t**	p;
     73 
     74     // user data
     75     int data;
     76     
     77 } st_number_t;
     78 
     79 
     80 
     81 // Percent widget ("child" of number widget,
     82 //  or, more precisely, contains a number widget.)
     83 typedef struct
     84 {
     85     // number information
     86     st_number_t		n;
     87 
     88     // percent sign graphic
     89     patch_t*		p;
     90     
     91 } st_percent_t;
     92 
     93 
     94 
     95 // Multiple Icon widget
     96 typedef struct
     97 {
     98      // center-justified location of icons
     99     int			x;
    100     int			y;
    101 
    102     // last icon number
    103     int			oldinum;
    104 
    105     // pointer to current icon
    106     int*		inum;
    107 
    108     // pointer to qboolean stating
    109     //  whether to update icon
    110     qboolean*		on;
    111 
    112     // list of icons
    113     patch_t**		p;
    114     
    115     // user data
    116     int			data;
    117     
    118 } st_multicon_t;
    119 
    120 
    121 
    122 
    123 // Binary Icon widget
    124 
    125 typedef struct
    126 {
    127     // center-justified location of icon
    128     int			x;
    129     int			y;
    130 
    131     // last icon value
    132     int			oldval;
    133 
    134     // pointer to current icon status
    135     qboolean*		val;
    136 
    137     // pointer to qboolean
    138     //  stating whether to update icon
    139     qboolean*		on;  
    140 
    141 
    142     patch_t*		p;	// icon
    143     int			data;   // user data
    144     
    145 } st_binicon_t;
    146 
    147 
    148 
    149 //
    150 // Widget creation, access, and update routines
    151 //
    152 
    153 // Initializes widget library.
    154 // More precisely, initialize STMINUS,
    155 //  everything else is done somewhere else.
    156 //
    157 void STlib_init(void);
    158 
    159 
    160 
    161 // Number widget routines
    162 void
    163 STlib_initNum
    164 ( st_number_t*		n,
    165   int			x,
    166   int			y,
    167   patch_t**		pl,
    168   int*			num,
    169   qboolean*		on,
    170   int			width );
    171 
    172 void
    173 STlib_updateNum
    174 ( st_number_t*		n,
    175   qboolean		refresh );
    176 
    177 
    178 // Percent widget routines
    179 void
    180 STlib_initPercent
    181 ( st_percent_t*		p,
    182   int			x,
    183   int			y,
    184   patch_t**		pl,
    185   int*			num,
    186   qboolean*		on,
    187   patch_t*		percent );
    188 
    189 
    190 void
    191 STlib_updatePercent
    192 ( st_percent_t*		per,
    193   int			refresh );
    194 
    195 
    196 // Multiple Icon widget routines
    197 void
    198 STlib_initMultIcon
    199 ( st_multicon_t*	mi,
    200   int			x,
    201   int			y,
    202   patch_t**		il,
    203   int*			inum,
    204   qboolean*		on );
    205 
    206 
    207 void
    208 STlib_updateMultIcon
    209 ( st_multicon_t*	mi,
    210   qboolean		refresh );
    211 
    212 // Binary Icon widget routines
    213 
    214 void
    215 STlib_initBinIcon
    216 ( st_binicon_t*		b,
    217   int			x,
    218   int			y,
    219   patch_t*		i,
    220   qboolean*		val,
    221   qboolean*		on );
    222 
    223 void
    224 STlib_updateBinIcon
    225 ( st_binicon_t*		bi,
    226   qboolean		refresh );
    227 
    228 #endif
    229