home *** CD-ROM | disk | FTP | other *** search
/ ST-Computer Leser-CD 2000 January / LCD_01_2000.iso / games / doom / pmdoom / include / hu_lib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-12-17  |  4.4 KB  |  197 lines

  1. /*  Emacs style mode select   -*- C++ -*-  */
  2. /* ----------------------------------------------------------------------------- */
  3. /*  */
  4. /*  $Id:$ */
  5. /*  */
  6. /*  Copyright (C) 1993-1996 by id Software, Inc. */
  7. /*  */
  8. /*  This source is available for distribution and/or modification */
  9. /*  only under the terms of the DOOM Source Code License as */
  10. /*  published by id Software. All rights reserved. */
  11. /*  */
  12. /*  The source is distributed in the hope that it will be useful, */
  13. /*  but WITHOUT ANY WARRANTY; without even the implied warranty of */
  14. /*  FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License */
  15. /*  for more details. */
  16. /*  */
  17. /*  DESCRIPTION:  none */
  18. /*  */
  19. /* ----------------------------------------------------------------------------- */
  20.  
  21. #ifndef __HULIB__
  22. #define __HULIB__
  23.  
  24. /*  We are referring to patches. */
  25. #include "r_defs.h"
  26.  
  27.  
  28. /*  background and foreground screen numbers */
  29. /*  different from other modules. */
  30. #define BG            1
  31. #define FG            0
  32.  
  33. /*  font stuff */
  34. #define HU_CHARERASE    KEY_BACKSPACE
  35.  
  36. #define HU_MAXLINES        4
  37. #define HU_MAXLINELENGTH    80
  38.  
  39. /*  */
  40. /*  Typedefs of widgets */
  41. /*  */
  42.  
  43. /*  Text Line widget */
  44. /*   (parent of Scrolling Text and Input Text widgets) */
  45. typedef struct
  46. {
  47.     /*  left-justified position of scrolling text window */
  48.     int        x;
  49.     int        y;
  50.     
  51.     patch_t**    f;            /*  font */
  52.     int        sc;            /*  start character */
  53.     char    l[HU_MAXLINELENGTH+1];    /*  line of text */
  54.     int        len;                  /*  current line length */
  55.  
  56.     /*  whether this line needs to be udpated */
  57.     int        needsupdate;          
  58.  
  59. } hu_textline_t;
  60.  
  61.  
  62.  
  63. /*  Scrolling Text window widget */
  64. /*   (child of Text Line widget) */
  65. typedef struct
  66. {
  67.     hu_textline_t    l[HU_MAXLINES];    /*  text lines to draw */
  68.     int            h;        /*  height in lines */
  69.     int            cl;        /*  current line number */
  70.  
  71.     /*  pointer to boolean stating whether to update window */
  72.     boolean*        on;
  73.     boolean        laston;        /*  last value of *->on. */
  74.  
  75. } hu_stext_t;
  76.  
  77.  
  78.  
  79. /*  Input Text Line widget */
  80. /*   (child of Text Line widget) */
  81. typedef struct
  82. {
  83.     hu_textline_t    l;        /*  text line to input on */
  84.  
  85.      /*  left margin past which I am not to delete characters */
  86.     int            lm;
  87.  
  88.     /*  pointer to boolean stating whether to update window */
  89.     boolean*        on; 
  90.     boolean        laston; /*  last value of *->on; */
  91.  
  92. } hu_itext_t;
  93.  
  94.  
  95. /*  */
  96. /*  Widget creation, access, and update routines */
  97. /*  */
  98.  
  99. /*  initializes heads-up widget library */
  100. void HUlib_init(void);
  101.  
  102. /*  */
  103. /*  textline code */
  104. /*  */
  105.  
  106. /*  clear a line of text */
  107. void    HUlib_clearTextLine(hu_textline_t *t);
  108.  
  109. void    HUlib_initTextLine(hu_textline_t *t, int x, int y, patch_t **f, int sc);
  110.  
  111. /*  returns success */
  112. boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch);
  113.  
  114. /*  returns success */
  115. boolean HUlib_delCharFromTextLine(hu_textline_t *t);
  116.  
  117. /*  draws tline */
  118. void    HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor);
  119.  
  120. /*  erases text line */
  121. void    HUlib_eraseTextLine(hu_textline_t *l); 
  122.  
  123.  
  124. /*  */
  125. /*  Scrolling Text window widget routines */
  126. /*  */
  127.  
  128. /*  ? */
  129. void
  130. HUlib_initSText
  131. ( hu_stext_t*    s,
  132.   int        x,
  133.   int        y,
  134.   int        h,
  135.   patch_t**    font,
  136.   int        startchar,
  137.   boolean*    on );
  138.  
  139. /*  add a new line */
  140. void HUlib_addLineToSText(hu_stext_t* s);  
  141.  
  142. /*  ? */
  143. void
  144. HUlib_addMessageToSText
  145. ( hu_stext_t*    s,
  146.   char*        prefix,
  147.   char*        msg );
  148.  
  149. /*  draws stext */
  150. void HUlib_drawSText(hu_stext_t* s);
  151.  
  152. /*  erases all stext lines */
  153. void HUlib_eraseSText(hu_stext_t* s); 
  154.  
  155. /*  Input Text Line widget routines */
  156. void
  157. HUlib_initIText
  158. ( hu_itext_t*    it,
  159.   int        x,
  160.   int        y,
  161.   patch_t**    font,
  162.   int        startchar,
  163.   boolean*    on );
  164.  
  165. /*  enforces left margin */
  166. void HUlib_delCharFromIText(hu_itext_t* it);
  167.  
  168. /*  enforces left margin */
  169. void HUlib_eraseLineFromIText(hu_itext_t* it);
  170.  
  171. /*  resets line and left margin */
  172. void HUlib_resetIText(hu_itext_t* it);
  173.  
  174. /*  left of left-margin */
  175. void
  176. HUlib_addPrefixToIText
  177. ( hu_itext_t*    it,
  178.   char*        str );
  179.  
  180. /*  whether eaten */
  181. boolean
  182. HUlib_keyInIText
  183. ( hu_itext_t*    it,
  184.   unsigned char ch );
  185.  
  186. void HUlib_drawIText(hu_itext_t* it);
  187.  
  188. /*  erases all itext lines */
  189. void HUlib_eraseIText(hu_itext_t* it); 
  190.  
  191. #endif
  192. /* ----------------------------------------------------------------------------- */
  193. /*  */
  194. /*  $Log:$ */
  195. /*  */
  196. /* ----------------------------------------------------------------------------- */
  197.