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

  1. #include <fastgraf.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. void main(void);
  6.  
  7. void main()
  8. {
  9.    int row;
  10.    int new_mode, old_mode;
  11.    char string[21];
  12.  
  13.    fg_initpm();
  14.    new_mode = fg_bestmode(320,200,2);
  15.    if (new_mode < 0 || new_mode == 12)
  16.    {
  17.       printf("This program requires a 320 ");
  18.       printf("x 200 color graphics mode.\n");
  19.       exit(1);
  20.    }
  21.    old_mode = fg_getmode();
  22.    fg_setmode(new_mode);
  23.  
  24.    fg_setcolor(7);
  25.    fg_rect(0,319,0,199);
  26.    fg_setcolor(9);
  27.  
  28.    for (row = 0; row < 25; row++)
  29.    {
  30.       sprintf(string,"   This is row %2d   ",row);
  31.       fg_locate(row,0);
  32.       fg_text(string,20);
  33.       fg_text(string,20);
  34.    }
  35.    fg_waitkey();
  36.  
  37.    fg_allocate(1);
  38.    fg_sethpage(1);
  39.    fg_save(96,223,88,111);
  40.    fg_setcolor(1);
  41.    fg_rect(96,223,88,111);
  42.    fg_setcolor(15);
  43.    fg_locate(12,13);
  44.    fg_text("Press any key.",14);
  45.    fg_waitkey();
  46.  
  47.    fg_restore(96,223,88,111);
  48.    fg_waitkey();
  49.  
  50.    fg_freepage(1);
  51.    fg_setmode(old_mode);
  52.    fg_reset();
  53. }
  54.