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

  1. #include "vogle.h"
  2.  
  3. #define S_PIX_ASPECT    1.2 
  4. static    int            old_mode = 3;
  5. extern    unsigned int    _cur_color;
  6. extern    unsigned int    _buffer_segment;
  7.  
  8. static    unsigned char     pal[17] = {0, 4, 2, 14, 1, 5, 3, 15,
  9.                         12, 10, 6, 9, 11, 13, 14, 15, 0};
  10.  
  11. extern    void    
  12.         sig_line(),
  13.         sig_set_colors();
  14.  
  15. extern    int    sigmaclear(),
  16.         pc_fill(),
  17.         pc_font(),
  18.         pc_getkey(),
  19.         pc_checkkey(),
  20.         pc_locator(),
  21.         pc_string(),
  22.         setmode();
  23.  
  24. static    int
  25. noop()
  26. {
  27.     return (-1);
  28. }
  29.  
  30.  
  31. static    unsigned    int    loc_val;
  32.  
  33. int
  34. sigma_init()
  35. {
  36.  
  37.     vdevice.sizeX = 399 * S_PIX_ASPECT;
  38.     vdevice.sizeY = 399;
  39.     vdevice.sizeSx = 639;
  40.     vdevice.sizeSy = 399;
  41.     vdevice.depth = 4;
  42.     _buffer_segment = (unsigned)0xB800;
  43.     old_mode = setmode(0x42);
  44.     sigma_set_colors(pal);
  45.     set_loc(64);
  46.     pc_locinit(vdevice.sizeSx, vdevice.sizeSy);
  47.     return (1);
  48. }
  49. /*
  50.  * sigma_exit
  51.  *
  52.  *    Sets the display back to text mode.
  53.  */
  54. sigma_exit()
  55. {
  56.     unshowmouse();
  57.     (void)setmode(3);
  58.     return (1);
  59. }
  60.  
  61. sigma_draw(x, y)
  62.     int    x, y;
  63. {
  64.     sig_line(vdevice.cpVx, vdevice.sizeSy - vdevice.cpVy, x, vdevice.sizeSy - y, _cur_color);
  65.     vdevice.cpVx = x;
  66.     vdevice.cpVy = y;
  67. }
  68.  
  69. sigma_char(c)
  70.     int    c;
  71. {
  72.     sigmachar(c, vdevice.cpVx, vdevice.sizeSy - vdevice.cpVy, _cur_color);
  73. }
  74.  
  75. sigma_color(i)
  76.     int    i;
  77. {
  78.     _cur_color = (unsigned)i;
  79. }
  80.  
  81. static DevEntry sigmadev = {
  82.     "sigma",
  83.     "large",
  84.     "small",
  85.     noop,
  86.     sigma_char,
  87.     pc_checkkey,
  88.     sigmaclear,
  89.     sigma_color,
  90.     sigma_draw,
  91.     sigma_exit,
  92.     pc_fill,
  93.     pc_font,
  94.     noop,
  95.     pc_getkey,
  96.     sigma_init,
  97.     pc_locator,
  98.     noop,
  99.     noop,
  100.     pc_string,
  101.     noop,
  102.     noop
  103. };
  104.  
  105. /*
  106.  * _sigma_devcpy
  107.  *
  108.  *    copy the pc device into vdevice.dev.
  109.  */
  110. _sigma_devcpy()
  111. {
  112.     vdevice.dev = sigmadev;
  113. }
  114.  
  115.