home *** CD-ROM | disk | FTP | other *** search
/ PC Underground / UNDERGROUND.ISO / graphic / scroll4.pas < prev    next >
Pascal/Delphi Source File  |  1995-07-28  |  1KB  |  27 lines

  1. Uses Crt,Gif,ModeXLib;
  2. Var x,                          {current offset in x-direction}
  3.     x_dir,                      {specifies scroll direction for x}
  4.     y,                          {current offset for y-direction}
  5.     y_dir:word;                 {specifies scroll direction for y}
  6. Begin
  7.   Init_ModeX;                   {enable Mode X}
  8.   double;                       {160 byte mode on (640*400 pixels total}
  9.   LoadGif('640400');            {load image}
  10.   p13_2_ModeX(vram_pos,rest div 4); {rest of image in video RAM}
  11.   x:=1;                         {x-beginning with column 1}
  12.   x_dir:=1;                     {x-direction 1 byte per pass}
  13.   y:=160;                       {y-beginning with line 1}
  14.   y_dir:=160;                   {y-direction +160 bytes per pass}
  15.   Repeat
  16.     Inc(x,x_dir);               {x-movement}
  17.     Inc(y,y_dir);               {y-movement}
  18.     WaitRetrace;                {wait for retrace}
  19.     SetStart(y+x);              {and write new start in register}
  20.     if (x >= 80)                {x-border reached -> turn x-direction around}
  21.     or (x <= 1) Then x_dir:=-x_dir;
  22.     if (y >= 200*160)           {y-border reached -> turn y-direction around}
  23.     or (y <= 160) Then y_dir:=-y_dir;
  24.   Until KeyPressed;             {run until key is pressed}
  25.   TextMode(3);
  26. End.
  27.