st_lib.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. #ifndef __STLIB__
  34. #define __STLIB__
  35. // We are referring to patches.
  36. #include "r_defs.h"
  37. #include "v_video.h" // color ranges
  38. //
  39. // Background and foreground screen numbers
  40. //
  41. #define BG 4
  42. #define FG 0
  43. //
  44. // Typedefs of widgets
  45. //
  46. // Number widget
  47. typedef struct
  48. {
  49. // upper right-hand corner
  50. // of the number (right-justified)
  51. int x;
  52. int y;
  53. // max # of digits in number
  54. int width;
  55. // last number value
  56. int oldnum;
  57. // pointer to current value
  58. int* num;
  59. // pointer to boolean stating
  60. // whether to update number
  61. boolean* on;
  62. // list of patches for 0-9
  63. const patchnum_t* p;
  64. // user data
  65. int data;
  66. } st_number_t;
  67. // Percent widget ("child" of number widget,
  68. // or, more precisely, contains a number widget.)
  69. typedef struct
  70. {
  71. // number information
  72. st_number_t n;
  73. // percent sign graphic
  74. const patchnum_t* p;
  75. } st_percent_t;
  76. // Multiple Icon widget
  77. typedef struct
  78. {
  79. // center-justified location of icons
  80. int x;
  81. int y;
  82. // last icon number
  83. int oldinum;
  84. // pointer to current icon
  85. int* inum;
  86. // pointer to boolean stating
  87. // whether to update icon
  88. boolean* on;
  89. // list of icons
  90. const patchnum_t* p;
  91. // user data
  92. int data;
  93. } st_multicon_t;
  94. // Binary Icon widget
  95. typedef struct
  96. {
  97. // center-justified location of icon
  98. int x;
  99. int y;
  100. // last icon value
  101. boolean oldval;
  102. // pointer to current icon status
  103. boolean* val;
  104. // pointer to boolean
  105. // stating whether to update icon
  106. boolean* on;
  107. const patchnum_t* p; // icon
  108. int data; // user data
  109. } st_binicon_t;
  110. //
  111. // Widget creation, access, and update routines
  112. //
  113. // Initializes widget library.
  114. // More precisely, initialize STMINUS,
  115. // everything else is done somewhere else.
  116. //
  117. void STlib_init(void);
  118. // Number widget routines
  119. void STlib_initNum
  120. ( st_number_t* n,
  121. int x,
  122. int y,
  123. const patchnum_t* pl,
  124. int* num,
  125. boolean* on,
  126. int width );
  127. void STlib_updateNum
  128. ( st_number_t* n,
  129. int cm,
  130. boolean refresh );
  131. // Percent widget routines
  132. void STlib_initPercent
  133. ( st_percent_t* p,
  134. int x,
  135. int y,
  136. const patchnum_t* pl,
  137. int* num,
  138. boolean* on,
  139. const patchnum_t* percent );
  140. void STlib_updatePercent
  141. ( st_percent_t* per,
  142. int cm,
  143. int refresh );
  144. // Multiple Icon widget routines
  145. void STlib_initMultIcon
  146. ( st_multicon_t* mi,
  147. int x,
  148. int y,
  149. const patchnum_t* il,
  150. int* inum,
  151. boolean* on );
  152. void STlib_updateMultIcon
  153. ( st_multicon_t* mi,
  154. boolean refresh );
  155. // Binary Icon widget routines
  156. void STlib_initBinIcon
  157. ( st_binicon_t* b,
  158. int x,
  159. int y,
  160. const patchnum_t* i,
  161. boolean* val,
  162. boolean* on );
  163. void STlib_updateBinIcon
  164. ( st_binicon_t* bi,
  165. boolean refresh );
  166. #endif