home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / fgl / fglight / exc.arj / TEMP / 12-02.C < prev    next >
Text File  |  1995-01-20  |  891b  |  46 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.    /* draw some type of background */
  26.  
  27.    fg_setcolor(15);
  28.    fg_rect(0,319,0,199);
  29.  
  30.    /* move the object across the screen */
  31.  
  32.    for (x = -20; x < 320; x+=5)
  33.    {
  34.       fg_setcolor(10);
  35.       fg_clprect(x,x+19,95,104);
  36.       fg_waitfor(1);
  37.       fg_setcolor(0);
  38.       fg_clprect(x,x+19,95,104);
  39.    }
  40.  
  41.    /* restore the original video mode and return to DOS */
  42.  
  43.    fg_setmode(old_mode);
  44.    fg_reset();
  45. }
  46.