home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / 2_DSCRL.ZIP / VIDPRIM.H < prev   
C/C++ Source or Header  |  1991-04-19  |  3KB  |  112 lines

  1. /***************************************************************
  2. * File:     VIDPRIM.H
  3. * Date:     February 1991
  4. * Purpose:  Header file for primitive video functions.
  5. * Authors:  Craig Miller, George Spofford.
  6. *
  7. * Source code may be used freely provided that
  8. * authorship/publication is acknowledged.
  9. ****************************************************************/
  10.  
  11. #if ! defined (_PASCAL)
  12. #if ! defined (DOS_386)
  13. #define _PASCAL pascal
  14. #define _CDECL cdecl
  15. #else
  16. #define _PASCAL
  17. #define _CDECL
  18. #endif
  19. #endif
  20.  
  21. #if __TURBOC__
  22. #define _CDECL
  23. #endif
  24.  
  25. #if ! defined (VIDPRIM_INC)
  26.  
  27. typedef short color_t;  /* hide type of IBM display attibutes */
  28.  
  29. #define N_DIM  2        /* # of screen dimensions */
  30. #define DOWN   0        /* vector array offsets -vertical */
  31. #define ACROSS 1        /* vector array offsets -horizontal */
  32.  
  33. typedef int vec_t[N_DIM];  /* basic vector */
  34.  
  35. typedef struct {        /* basic bounding box */
  36.         vec_t o;        /* upper-left cormer */
  37.         vec_t n;        /* # of units */
  38. } bbox_t;
  39.  
  40. /*------------------  VIDSTATE functions  --------------------*/
  41. #undef DEF
  42. #ifndef VIDPRIM_SRC
  43. #define DEF extern
  44. #else
  45. #define DEF
  46. #endif
  47.  
  48. DEF void  _PASCAL InitDisplay (int mode, int rows);
  49. DEF void         ClearScreen (void );
  50. DEF void         ClearBox (bbox_t *bbp);
  51. DEF void         SetCurBox (bbox_t *bbp);
  52. DEF void         CursorOff (void);
  53. DEF void _PASCAL SetTextCursor (int r, int c);
  54.         /* next function returns old attribute */
  55. DEF color_t      SetCurAttrib (color_t attr);
  56. DEF void _PASCAL ScrollBox (bbox_t *bbp, int nd, int na);
  57. DEF int  _PASCAL x_outtext (int r, int c, char *str);
  58. DEF int  _PASCAL x_outch (int r, int c, char ch);
  59. DEF int  _CDECL  xput_string (int r, int c, char *fmt,...);
  60. #undef DEF
  61.  
  62. /* handy bbox-setting macro */
  63. #define BBSET( b, od, oa, nd, na) \
  64. {(b).o[DOWN]=od; (b).o[ACROSS]=oa; \
  65. (b).n[DOWN]=nd; (b).n[ACROSS]=na;}
  66.  
  67. /* Video and font control codes */
  68. #define EGA_setvideomode(m)   VideoBios2((m),0,0)
  69.  
  70. #define SCAN400         0x02
  71. #define SCAN350         0x01
  72. #define SCAN200         0x00
  73. #define SETSCANLINES    0x12
  74. #define VGA_400lines() \
  75.         VideoBios1 (SCAN400, SETSCANLINES, 0x30, 0)
  76. #define EGA_350lines() \
  77.         VideoBios1 (SCAN350, SETSCANLINES, 0x30, 0)
  78. #define VGA_350lines() \
  79.         VideoBios1 (SCAN350, SETSCANLINES, 0x30, 0)
  80. #define EGA_200lines() \
  81.         VideoBios1 (SCAN200, SETSCANLINES, 0x30, 0)
  82.  
  83. #define SETFONT         0x11
  84. #define FONT8X8NORESET  0x12
  85. #define FONT8X16NORESET 0x14
  86. #define EGA_SetFont(f)  VideoBios1 (f, SETFONT, 0, 0)
  87.  
  88. /* handy color constants */
  89.  
  90. #define MK_ATTR(b,f) (((b) << 4) + (f))
  91.  
  92. #define CGA_BLACK     0x00
  93. #define CGA_BLUE      0x01
  94. #define CGA_GREEN     0x02
  95. #define CGA_CYAN      0x03
  96. #define CGA_RED       0x04
  97. #define CGA_MAGENTA   0x05
  98. #define CGA_BROWN     0x06
  99. #define CGA_WHITE     0x07
  100. #define CGA_GREY      0x08
  101. #define CGA_LTBLUE    0x09
  102. #define CGA_LTGREEN   0x0A
  103. #define CGA_LTCYAN    0x0B
  104. #define CGA_LTRED     0x0C
  105. #define CGA_LTMAGENTA 0x0D
  106. #define CGA_YELLOW    0x0E
  107. #define CGA_LTWHITE   0x0F
  108.  
  109. #define VIDPRIM_INC
  110. #endif
  111.  
  112. /* END OF VIDPRIM.H */