home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / fgl / fglight / expas.arj / TEMP / 12-04.PAS < prev    next >
Pascal/Delphi Source File  |  1995-01-20  |  2KB  |  78 lines

  1. {$M 16384,0,0}
  2.  
  3. program main;
  4. uses fgmain, fgmisc;
  5.  
  6. const
  7.   VISUAL = 0;
  8.   HIDDEN = 1;
  9.  
  10.   xmin : array [0..11] of integer =
  11.             ( 0, 96,192,  0, 96,192,  0, 96,192,  0, 96,192);
  12.   ymax : array [0..11] of integer =
  13.             (49, 49, 49, 99, 99, 99,149,149,149,199,199,199);
  14.  
  15. var
  16.    status   : integer;
  17.    new_mode : integer;
  18.    old_mode : integer;
  19.    frame, offset : integer;
  20.    i, x, y : integer;
  21.  
  22. begin
  23.  
  24.   { initialize the video environment }
  25.  
  26.   fg_initpm;
  27.   new_mode := fg_bestmode(320,200,2);
  28.   if (new_mode < 0) or (new_mode = 12) then
  29.   begin
  30.     write('This program requires a 320 ');
  31.     writeln('x 200 color graphics mode.');
  32.     exit;
  33.   end;
  34.   old_mode := fg_getmode;
  35.   fg_setmode(new_mode);
  36.   status := fg_allocate(HIDDEN);
  37.  
  38.   { draw the background in the upper left corner }
  39.  
  40.   fg_setpage(HIDDEN);
  41.   fg_setcolor(1);
  42.   fg_rect(0,95,0,49);
  43.   fg_setcolor(15);
  44.   fg_move(48,25);
  45.   fg_ellipse(20,20);
  46.  
  47.   { display the animated object against each background }
  48.  
  49.   fg_setcolor(10);
  50.   offset := -10;
  51.   for i := 1 to 11 do
  52.   begin
  53.     x := xmin[i];
  54.     y := ymax[i];
  55.     fg_transfer(0,95,0,49,x,y,HIDDEN,HIDDEN);
  56.     fg_setclip(x,x+95,0,199);
  57.     fg_clprect(x+offset,x+offset+19,y-29,y-20);
  58.     inc(offset,10);
  59.   end;
  60.  
  61.   { slide the object across the background three times }
  62.  
  63.   for i := 0 to 35 do
  64.   begin
  65.     frame := i mod 12;
  66.     x := xmin[frame];
  67.     y := ymax[frame];
  68.     fg_transfer(x,x+95,y-49,y,112,124,HIDDEN,VISUAL);
  69.     fg_waitfor(2);
  70.   end;
  71.  
  72.   { restore the original video mode and return to DOS }
  73.  
  74.   status := fg_freepage(HIDDEN);
  75.   fg_setmode(old_mode);
  76.   fg_reset;
  77. end.
  78.