home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / VOGLE.ZIP / VOGLE / DRIVERS / IBMPC / HGC.C < prev    next >
C/C++ Source or Header  |  2000-02-11  |  2KB  |  119 lines

  1. #include "vogle.h"
  2.  
  3. #define H_PIX_ASPECT    1.45   /* For real PC monitor */
  4. /*#define H_PIX_ASPECT    1.0    /* For SUN emulator */
  5. extern    unsigned    int    _cur_color;
  6.  
  7. extern    void    
  8.         hgc_tmode(),
  9.         hgc_gmode(),
  10.         hgc_config(),
  11.         set_loc(),
  12.         hgcline();
  13.  
  14. extern    int    hgc_clear(),
  15.         hgc_backbuf(),
  16.         pc_fill(),
  17.         pc_font(),
  18.         pc_getkey(),
  19.         pc_checkkey(),
  20.         pc_locator(),
  21.         pc_string(),
  22.         hgc_frontbuf(),
  23.         hgc_swapbuf(),
  24.         setmode();
  25.  
  26. static    int
  27. noop()
  28. {
  29.     return (-1);
  30. }
  31.  
  32.  
  33. int
  34. hgc_init()
  35. {
  36.     vdevice.sizeX = 347 * H_PIX_ASPECT;
  37.     vdevice.sizeY = 347;
  38.     vdevice.sizeSx = 719;
  39.     vdevice.sizeSy = 347;
  40.     vdevice.depth = 1;
  41.     hgc_config();
  42.     hgc_gmode();    /* Also sets _buffer_segment */
  43.     _cur_color = 0;
  44.     hgc_clear();
  45.     _cur_color = 1;
  46.     set_loc(5);    /* For the mouse */
  47.     pc_locinit(vdevice.sizeSx, vdevice.sizeSy);
  48.     return (1);
  49. }
  50. /*
  51.  * hgc_exit
  52.  *
  53.  *    Sets the display back to text mode.
  54.  */
  55. hgc_exit()
  56. {
  57.     unshowmouse();
  58.     /*hgc_tmode();
  59.     _cur_color = 0;
  60.     _hgc_clear();
  61.     */
  62.     (void)setmode(3);
  63.     return (1);
  64. }
  65.  
  66. hgc_draw(x, y)
  67.     int    x, y;
  68. {
  69.     hgcline(vdevice.cpVx, vdevice.sizeSy - vdevice.cpVy, x, vdevice.sizeSy - y, _cur_color);
  70.     vdevice.cpVx = x;
  71.     vdevice.cpVy = y;
  72. }
  73.  
  74. hgc_char(c)
  75.     int    c;
  76. {
  77.     hgcchar(c, vdevice.cpVx, vdevice.sizeSy - vdevice.cpVy, _cur_color, 1 - _cur_color);
  78. }
  79.  
  80. hgc_color(i)
  81.     int    i;
  82. {
  83.     _cur_color = (i > 0 ? 1 : 0);
  84. }
  85.  
  86. static DevEntry hgcdev = {
  87.     "hercules",
  88.     "large",
  89.     "small",
  90.     hgc_backbuf,
  91.     hgc_char,
  92.     pc_checkkey,
  93.     hgc_clear,
  94.     hgc_color,
  95.     hgc_draw,
  96.     hgc_exit,
  97.     pc_fill,
  98.     pc_font,
  99.     hgc_frontbuf,
  100.     pc_getkey,
  101.     hgc_init,
  102.     pc_locator,
  103.     noop,
  104.     pc_string,
  105.     hgc_swapbuf,
  106.     noop
  107. };
  108.  
  109. /*
  110.  * _hgc_devcpy
  111.  *
  112.  *    copy the pc device into vdevice.dev.
  113.  */
  114. _hgc_devcpy()
  115. {
  116.     vdevice.dev = hgcdev;
  117. }
  118.  
  119.