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

  1. #include <fastgraf.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. void main(void);
  6. void redraw(void);
  7.  
  8. void main()
  9. {
  10.    int new_mode, old_mode;
  11.    double xmin, xmax, ymin, ymax;
  12.  
  13.    old_mode = fg_getmode();
  14.    new_mode = fg_automode();
  15.  
  16.    if (new_mode == 0) {
  17.       printf("This program requires graphics.\n");
  18.       exit(1);
  19.       }
  20.  
  21.    fg_setmode(new_mode);
  22.    fg_initw();
  23.  
  24.    fg_setworld(0.0,40.0,0.0,30.0);
  25.    redraw();
  26.    fg_waitkey();
  27.  
  28.    fg_getworld(&xmin,&xmax,&ymin,&ymax);
  29.    fg_setworld(0.0,xmax*0.5,0.0,ymax*0.5);
  30.    redraw();
  31.    fg_waitkey();
  32.  
  33.    fg_setmode(old_mode);
  34.    fg_reset();
  35. }
  36.  
  37. void redraw()
  38. {
  39.    fg_erase();
  40.    fg_setcolor(1);
  41.  
  42.    fg_movew(0.0,0.0);
  43.    fg_draww(0.0,10.0);
  44.    fg_draww(10.0,10.0);
  45.    fg_draww(10.0,0.0);
  46.    fg_draww(0.0,0.0);
  47. }
  48.