home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / xaes_new / xvdi.c < prev   
C/C++ Source or Header  |  1994-12-04  |  4KB  |  162 lines

  1. /********************************************************************
  2.  *                                                                0.90*
  3.  *    XAES: Extended Video Display Interface routines                    *
  4.  *    by Ken Hollis                                                    *
  5.  *                                                                    *
  6.  *    Copyright (c) 1994, Bitgate Software.  All Rights Reserved.        *
  7.  *                                                                    *
  8.  *    These are the extended VDI routines.  They also make it so that    *
  9.  *    most commonly called routines are used with one call.  The KISS    *
  10.  *    method works unbelievably well.                                    *
  11.  *                                                                    *
  12.  ********************************************************************/
  13.  
  14. #include "xaes.h"
  15.  
  16. XVDIVARS SaveHandles;
  17.  
  18. GLOBAL void line(int x1, int y1, int x2, int y2)
  19. {
  20.     int pxyarray[4];
  21.  
  22.     pxyarray[0] = x1;
  23.     pxyarray[1] = y1;
  24.     pxyarray[2] = x2;
  25.     pxyarray[3] = y2;
  26.  
  27.     v_pline(VDIhandle, 2, pxyarray);
  28. }
  29.  
  30. GLOBAL void point(int x, int y, int color)
  31. {
  32.     int pxyarray[2];
  33.  
  34.     pxyarray[0] = x;
  35.     pxyarray[1] = y;
  36.  
  37.     vsm_color(VDIhandle, color);
  38.     v_pmarker(VDIhandle, 1, pxyarray);
  39. }
  40.  
  41. GLOBAL void box(int x, int y, int w, int h, int color)
  42. {
  43.     int pxyarray[10];
  44.  
  45.     pxyarray[2] = pxyarray[4] = (pxyarray[0] = pxyarray[6] = pxyarray[8] = x) + w;
  46.     pxyarray[5] = pxyarray[7] = (pxyarray[1] = pxyarray[3] = pxyarray[9] = y) + h;
  47.  
  48.     vsl_color(VDIhandle, color);
  49.     v_pline(VDIhandle, 5, pxyarray);
  50. }
  51.  
  52. GLOBAL void box_fill(int x, int y, int w, int h, int color)
  53. {
  54.     int pxyarray[4];
  55.  
  56.     pxyarray[2] = (pxyarray[0] = x) + w;
  57.     pxyarray[3] = (pxyarray[1] = y) + h;
  58.  
  59. /*    vsf_interior(VDIhandle, 1); */
  60.     vsf_color(VDIhandle, color);
  61.     vsl_color(VDIhandle, color);
  62.     v_bar(VDIhandle, pxyarray);
  63. }
  64.  
  65. GLOBAL void fillarea(int x1, int y1, int x2, int y2, int interior, int color)
  66. {
  67.     int pxyarray[4];
  68.  
  69.     pxyarray[0] = x1;
  70.     pxyarray[1] = y1;
  71.     pxyarray[2] = x2;
  72.     pxyarray[3] = y2;
  73.  
  74.     vsf_interior(VDIhandle, interior);
  75.     vsf_color(VDIhandle, color);
  76.  
  77.     v_fillarea(VDIhandle, 2, pxyarray);
  78. }
  79.  
  80. GLOBAL void fill(int x, int y, int color)
  81. {
  82.     vsf_interior(VDIhandle, 1);
  83.     vsf_color(VDIhandle, color);
  84.  
  85.     v_contourfill(VDIhandle, x, y, color);
  86. }
  87.  
  88. GLOBAL void XVDI_SaveHandles(void)
  89. {
  90.     int i;
  91.  
  92.     vqt_attributes(VDIhandle, SaveHandles.textattributes);
  93.     vqf_attributes(VDIhandle, SaveHandles.fillattributes);
  94.     vql_attributes(VDIhandle, SaveHandles.lineattributes);
  95.  
  96.     vswr_mode(VDIhandle, MD_REPLACE);
  97.  
  98.     vst_color(VDIhandle, BLACK);
  99.     vst_rotation(VDIhandle, 0);
  100.     vst_height(VDIhandle, 6, &i, &i, &i, &i);
  101.     vst_effects(VDIhandle, 0);
  102.  
  103.     vsf_interior(VDIhandle, FIS_SOLID);
  104.     vsf_color(VDIhandle, BLACK);
  105.     vsf_style(VDIhandle, 7);
  106.     vsf_perimeter(VDIhandle, 0);
  107.  
  108.     vsl_type(VDIhandle, 1);
  109.     vsl_color(VDIhandle, BLACK);
  110.     vsl_width(VDIhandle, 1);
  111. }
  112.  
  113. GLOBAL void XVDI_RestoreHandles(void)
  114. {
  115.     int    i;
  116.  
  117.     vst_color(VDIhandle, SaveHandles.textattributes[1]);
  118.     vst_rotation(VDIhandle, SaveHandles.textattributes[2]);
  119.     vst_alignment(VDIhandle, SaveHandles.textattributes[3], SaveHandles.textattributes[4], &i, &i);
  120.     vst_effects(VDIhandle, 0);
  121.  
  122. /* Why they save the writing mode three times I may never know, but
  123.    they do.  Use the text attributes, since it's text we're using
  124.    for the drawing mode.  If not, change the writing mode in your
  125.    own routine. */
  126.  
  127.     vswr_mode(VDIhandle, SaveHandles.textattributes[5]);
  128. /*    vswr_mode(VDIhandle, SaveHandles.fillattributes[3]); */
  129. /*    vswr_mode(VDIhandle, SaveHandles.lineattributes[2]); */
  130.  
  131.     vst_height(VDIhandle, SaveHandles.textattributes[7], &i, &i, &i, &i);
  132.  
  133.     vsf_interior(VDIhandle, SaveHandles.fillattributes[0]);
  134.     vsf_color(VDIhandle, SaveHandles.fillattributes[1]);
  135.     vsf_style(VDIhandle, SaveHandles.fillattributes[2]);
  136.     vsf_perimeter(VDIhandle, SaveHandles.fillattributes[4]);
  137.  
  138.     vsl_type(VDIhandle, SaveHandles.lineattributes[0]);
  139.     vsl_color(VDIhandle, SaveHandles.lineattributes[1]);
  140.     vsl_width(VDIhandle, SaveHandles.lineattributes[5]);
  141. }
  142.  
  143. GLOBAL void XVDI_RestoreForGEM(void)
  144. {
  145.     int    i;
  146.  
  147.     vst_color(VDIhandle, BLACK);
  148.     vst_rotation(VDIhandle, 0);
  149.     vst_effects(VDIhandle, 0);
  150.  
  151.     vswr_mode(VDIhandle, MD_REPLACE);
  152.     vst_height(VDIhandle, 6, &i, &i, &i, &i);
  153.  
  154.     vsf_interior(VDIhandle, FIS_HOLLOW);
  155.     vsf_color(VDIhandle, WHITE);
  156.     vsl_udsty(VDIhandle,0x5555);
  157.     vsl_type(VDIhandle,1);
  158.     vsf_perimeter(VDIhandle, 1);
  159.  
  160.     vsl_color(VDIhandle, BLACK);
  161.     vsl_width(VDIhandle, 1);
  162. }