home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / fgl / fglight / exc.arj / TEMP / 12-06.C < prev    next >
Text File  |  1995-01-20  |  972b  |  52 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 old_mode;
  10.    int hidden;
  11.    int x;
  12.  
  13.    /* initialize the video environment */
  14.  
  15.    fg_initpm();
  16.    if (fg_testmode(13,3) == 0)
  17.    {
  18.       printf("This program requires EGA.\n");
  19.       exit(1);
  20.    }
  21.    old_mode = fg_getmode();
  22.    fg_setmode(13);
  23.  
  24.    /* draw the background on page two */
  25.  
  26.    fg_setpage(2);
  27.    fg_setcolor(1);
  28.    fg_rect(0,319,0,199);
  29.    fg_setcolor(15);
  30.    fg_move(160,100);
  31.    fg_ellipse(20,20);
  32.  
  33.    /* slide the object across the screen */
  34.  
  35.    hidden = 1;
  36.    fg_setcolor(10);
  37.    for (x = -10; x < 320; x+=4)
  38.    {
  39.       fg_setpage(hidden);
  40.       fg_transfer(0,319,0,199,0,199,2,hidden);
  41.       fg_clprect(x,x+19,96,105);
  42.       fg_setvpage(hidden);
  43.       hidden = 1 - hidden;
  44.       fg_waitfor(1);
  45.    }
  46.  
  47.    /* restore the original video mode and return to DOS */
  48.  
  49.    fg_setmode(old_mode);
  50.    fg_reset();
  51. }
  52.