home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 12 / CD_ASCQ_12_0294.iso / maj / 4401 / exc.arj / FGDOC / EXAMPLES / C / 10-16.C < prev    next >
Text File  |  1994-01-24  |  1KB  |  47 lines

  1. #include <fastgraf.h>
  2. #include <io.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. void main(void);
  7.  
  8. char pixel_runs[20000];
  9.  
  10. void main()
  11. {
  12.    FILE *stream;
  13.    int file_size, run_count;
  14.    int old_mode, new_mode;
  15.  
  16.    new_mode = fg_bestmode(320,200,1);
  17.    if (new_mode < 0 || new_mode == 12) {
  18.       printf("This program requires a 320 ");
  19.       printf("x 200 color graphics mode.\n");
  20.       exit(1);
  21.       }
  22.  
  23.    old_mode = fg_getmode();
  24.    fg_setmode(new_mode);
  25.  
  26.    stream = fopen("coral.spr","rb");
  27.    file_size = (int)(filelength(fileno(stream)));
  28.    fread(pixel_runs,sizeof(char),file_size,stream);
  29.    fclose(stream);
  30.    run_count = file_size / 2;
  31.    fg_move(0,199);
  32.    fg_display(pixel_runs,run_count,320);
  33.    fg_waitkey();
  34.  
  35.    stream = fopen("coral.ppr","rb");
  36.    file_size = (int)(filelength(fileno(stream)));
  37.    fread(pixel_runs,sizeof(char),file_size,stream);
  38.    fclose(stream);
  39.    run_count = file_size / 3 * 2;
  40.    fg_erase();
  41.    fg_displayp(pixel_runs,run_count,320);
  42.    fg_waitkey();
  43.  
  44.    fg_setmode(old_mode);
  45.    fg_reset();
  46. }
  47.