home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 12 / CD_ASCQ_12_0294.iso / maj / 4401 / exc.arj / FGDOC / EXAMPLES / C / 06-08.C < prev    next >
Text File  |  1994-01-24  |  874b  |  44 lines

  1. #include <fastgraf.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. void main(void);
  6.  
  7. #define VERTICES 10
  8.  
  9. int xy[] = {200,100, 300, 80, 400,100, 400,220, 300,320,
  10.             240,320, 160,240, 160,200, 200,160, 210,150};
  11. int work_array[700];
  12.  
  13. void main()
  14. {
  15.    int old_mode;
  16.  
  17.    old_mode = fg_getmode();
  18.  
  19.    if (fg_testmode(16,1))
  20.       fg_setmode(16);
  21.    else if (fg_testmode(15,1))
  22.       fg_setmode(15);
  23.    else {
  24.       printf("This program requires a 640 x 350 ");
  25.       printf("EGA graphics mode.\n");
  26.       exit(1);
  27.       }
  28.  
  29.    fg_setcolor(1);
  30.    fg_polyoff(-120,-25);
  31.    fg_polyline(xy,VERTICES);
  32.    fg_polyoff(200,-25);
  33.    fg_polyfill(xy,work_array,VERTICES);
  34.    fg_waitkey();
  35.  
  36.    fg_setcolor(2);
  37.    fg_setclip(480,639,175,349);
  38.    fg_polyfill(xy,work_array,VERTICES);
  39.    fg_waitkey();
  40.  
  41.    fg_setmode(old_mode);
  42.    fg_reset();
  43. }
  44.