home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / EXPLOD.ZIP / DEMO.PAS next >
Encoding:
Pascal/Delphi Source File  |  1988-01-13  |  1.2 KB  |  55 lines

  1. {$R-,S-}
  2.  
  3. uses
  4.   TPCrt,
  5.   TPWindow;
  6.  
  7. const
  8.   MaxLoop = 40;  {Number of windows drawn before erasing}
  9.   ExpDelay = 20; {Milliseconds delay per stage of explosion}
  10. var
  11.   Flag : Boolean;
  12.   Loop : Word;
  13.   W : WindowPtr;
  14.   Ch : Char;
  15.  
  16.   procedure ShowWindow(Loop : Word);
  17.   var
  18.     Wndow : array[1..MaxLoop] of WindowPtr;
  19.     XL, XH : 1..80;
  20.     YL, YH : 1..25;
  21.     Attr, Frame : Byte;
  22.   begin
  23.     XH := Random(78)+3;
  24.     XL := Succ(Random(XH-3));
  25.     YH := Random(23)+3;
  26.     YL := Succ(Random(YH-3));
  27.     Attr := Succ(Random(127));
  28.     Frame := Succ(Random(127));
  29.     if MakeWindow(Wndow[Loop], XL, YL, XH, YH,
  30.                   True, True, False, Attr, Frame, 0, '') then
  31.       Flag := DisplayWindow(Wndow[Loop]);
  32.     HiddenCursor;
  33.   end;
  34.  
  35. begin
  36.   WriteLn('Press any key to halt');
  37.   WriteLn('Call with any command line parameter to add sound effects');
  38.   Explode := True;
  39.   ExplodeDelay := ExpDelay;
  40.   SoundFlagW := (ParamCount <> 0);
  41.   repeat
  42.     Randomize;
  43.     Loop := 1;
  44.     while (Loop <= MaxLoop) and not KeyPressed do begin
  45.       ShowWindow(Loop);
  46.       inc(Loop);
  47.     end;
  48.     repeat
  49.       W := EraseTopWindow;
  50.       DisposeWindow(W);
  51.     until W = nil;
  52.   until KeyPressed;
  53.   Ch := ReadKey;
  54. end.
  55.