st_lib.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. /*
  2. ===========================================================================
  3. Doom 3 BFG Edition GPL Source Code
  4. Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
  6. Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. 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.
  17. 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.
  18. ===========================================================================
  19. */
  20. #ifndef __STLIB__
  21. #define __STLIB__
  22. // We are referring to patches.
  23. #include "r_defs.h"
  24. //
  25. // Background and foreground screen numbers
  26. //
  27. #define BG 4
  28. #define FG 0
  29. //
  30. // Typedefs of widgets
  31. //
  32. // Number widget
  33. typedef struct
  34. {
  35. // upper right-hand corner
  36. // of the number (right-justified)
  37. int x;
  38. int y;
  39. // max # of digits in number
  40. int width;
  41. // last number value
  42. int oldnum;
  43. // pointer to current value
  44. int* num;
  45. // pointer to qboolean stating
  46. // whether to update number
  47. qboolean* on;
  48. // list of patches for 0-9
  49. patch_t** p;
  50. // user data
  51. int data;
  52. } st_number_t;
  53. // Percent widget ("child" of number widget,
  54. // or, more precisely, contains a number widget.)
  55. typedef struct
  56. {
  57. // number information
  58. st_number_t n;
  59. // percent sign graphic
  60. patch_t* p;
  61. } st_percent_t;
  62. // Multiple Icon widget
  63. typedef struct
  64. {
  65. // center-justified location of icons
  66. int x;
  67. int y;
  68. // last icon number
  69. int oldinum;
  70. // pointer to current icon
  71. int* inum;
  72. // pointer to qboolean stating
  73. // whether to update icon
  74. qboolean* on;
  75. // list of icons
  76. patch_t** p;
  77. // user data
  78. int data;
  79. } st_multicon_t;
  80. // Binary Icon widget
  81. typedef struct
  82. {
  83. // center-justified location of icon
  84. int x;
  85. int y;
  86. // last icon value
  87. int oldval;
  88. // pointer to current icon status
  89. qboolean* val;
  90. // pointer to qboolean
  91. // stating whether to update icon
  92. qboolean* on;
  93. patch_t* p; // icon
  94. int data; // user data
  95. } st_binicon_t;
  96. //
  97. // Widget creation, access, and update routines
  98. //
  99. // Initializes widget library.
  100. // More precisely, initialize STMINUS,
  101. // everything else is done somewhere else.
  102. //
  103. void STlib_init(void);
  104. // Number widget routines
  105. void
  106. STlib_initNum
  107. ( st_number_t* n,
  108. int x,
  109. int y,
  110. patch_t** pl,
  111. int* num,
  112. qboolean* on,
  113. int width );
  114. void
  115. STlib_updateNum
  116. ( st_number_t* n,
  117. qboolean refresh );
  118. // Percent widget routines
  119. void
  120. STlib_initPercent
  121. ( st_percent_t* p,
  122. int x,
  123. int y,
  124. patch_t** pl,
  125. int* num,
  126. qboolean* on,
  127. patch_t* percent );
  128. void
  129. STlib_updatePercent
  130. ( st_percent_t* per,
  131. int refresh );
  132. // Multiple Icon widget routines
  133. void
  134. STlib_initMultIcon
  135. ( st_multicon_t* mi,
  136. int x,
  137. int y,
  138. patch_t** il,
  139. int* inum,
  140. qboolean* on );
  141. void
  142. STlib_updateMultIcon
  143. ( st_multicon_t* mi,
  144. qboolean refresh );
  145. // Binary Icon widget routines
  146. void
  147. STlib_initBinIcon
  148. ( st_binicon_t* b,
  149. int x,
  150. int y,
  151. patch_t* i,
  152. qboolean* val,
  153. qboolean* on );
  154. void
  155. STlib_updateBinIcon
  156. ( st_binicon_t* bi,
  157. qboolean refresh );
  158. #endif