home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / fgl / fglight / exc.arj / TEMP / 10-22.C < prev    next >
Text File  |  1995-01-20  |  1KB  |  49 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.    fg_initpm();
  17.    new_mode = fg_bestmode(320,200,1);
  18.    if (new_mode < 0 || new_mode == 12)
  19.    {
  20.       printf("This program requires a 320 ");
  21.       printf("x 200 color graphics mode.\n");
  22.       exit(1);
  23.    }
  24.  
  25.    old_mode = fg_getmode();
  26.    fg_setmode(new_mode);
  27.  
  28.    stream = fopen("coral.spr","rb");
  29.    file_size = (int)(filelength(fileno(stream)));
  30.    fread(pixel_runs,sizeof(char),file_size,stream);
  31.    fclose(stream);
  32.    run_count = file_size / 2;
  33.    fg_move(0,199);
  34.    fg_display(pixel_runs,run_count,320);
  35.    fg_waitkey();
  36.  
  37.    stream = fopen("coral.ppr","rb");
  38.    file_size = (int)(filelength(fileno(stream)));
  39.    fread(pixel_runs,sizeof(char),file_size,stream);
  40.    fclose(stream);
  41.    run_count = file_size / 3 * 2;
  42.    fg_erase();
  43.    fg_displayp(pixel_runs,run_count,320);
  44.    fg_waitkey();
  45.  
  46.    fg_setmode(old_mode);
  47.    fg_reset();
  48. }
  49.