home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / fgl / fglight / exc.arj / TEMP / 09-11.C < prev    next >
Text File  |  1995-01-20  |  975b  |  49 lines

  1. #include <fastgraf.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. void main(void);
  6.  
  7. int CGApatterns[] = {
  8.    0x0000,0x00FF,0x00FF,0x00FF,
  9.    0x02BB,0x0000,0x0222,0x0255,
  10.    0x00FF,0x00FF,0x00FF,0x0055,
  11.    0x00AA,0x00AA,0x00FF,0x0277
  12.    };
  13.  
  14. void main()
  15. {
  16.    int color;
  17.    int old_mode, new_mode;
  18.  
  19.    fg_initpm();
  20.    new_mode = fg_bestmode(320,200,1);
  21.    if (new_mode < 0 || new_mode == 12)
  22.    {
  23.       printf("This program requires a 320 ");
  24.       printf("x 200 color graphics mode.\n");
  25.       exit(1);
  26.    }
  27.  
  28.    old_mode = fg_getmode();
  29.    fg_setmode(new_mode);
  30.  
  31.    if (new_mode == 4)
  32.    {
  33.       fg_palette(0,0);
  34.       for (color = 0; color < 16; color++)
  35.          fg_pattern(color,CGApatterns[color]);
  36.    }
  37.    else if (new_mode == 9 || new_mode == 13)
  38.       fg_pattern(15,0x04F7);
  39.    else
  40.       fg_setrgb(15,38,38,38);
  41.  
  42.    fg_move(0,199);
  43.    fg_showppr("CORAL.PPR",320);
  44.    fg_waitkey();
  45.  
  46.    fg_setmode(old_mode);
  47.    fg_reset();
  48. }
  49.