home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / fgl / fglight / exc.arj / TEMP / 12-01.C < prev    next >
Text File  |  1995-01-20  |  800b  |  40 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 new_mode, old_mode;
  10.    int x;
  11.  
  12.    /* initialize the video environment */
  13.  
  14.    fg_initpm();
  15.    new_mode = fg_bestmode(320,200,1);
  16.    if (new_mode < 0 || new_mode == 12)
  17.    {
  18.       printf("This program requires a 320 ");
  19.       printf("x 200 color graphics mode.\n");
  20.       exit(1);
  21.    }
  22.    old_mode = fg_getmode();
  23.    fg_setmode(new_mode);
  24.  
  25.    /* move the object across the screen */
  26.  
  27.    for (x = -20; x < 320; x+=5) {
  28.       fg_setcolor(10);
  29.       fg_clprect(x,x+19,95,104);
  30.       fg_waitfor(1);
  31.       fg_setcolor(0);
  32.       fg_clprect(x,x+19,95,104);
  33.       }
  34.  
  35.    /* restore the original video mode and return to DOS */
  36.  
  37.    fg_setmode(old_mode);
  38.    fg_reset();
  39. }
  40.