home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / mlib / source / win / mwin.cpp < prev    next >
Encoding:
Text File  |  1994-02-26  |  5.4 KB  |  203 lines

  1. indVesaMode(xsize,ysize,24);
  2.     END;
  3.     IF mode = 0 THEN BEGIN
  4.         WriteLn('No such mode could be found !');
  5.         WriteLn('Switching to to 320x200.');
  6.         ReadKey;
  7.         mode := V320x200x256;
  8.     END;
  9. END;
  10.  
  11. begin { program body }
  12.   SelectMode;
  13.   Initialize;
  14.   ReportStatus;
  15.  
  16. {  AspectRatioPlay; }
  17.   FillEllipsePlay;
  18.   SectorPlay;
  19.   WriteModePlay;
  20.  
  21.   ColorPlay;
  22.   { PalettePlay only intended to work on these drivers: }
  23.   if (GraphDriver = EGA) or
  24.       (GraphDriver = EGA64) or
  25.       (GraphDriver = VGA) then
  26.      PalettePlay;
  27.   PutPixelPlay;
  28. {  PutImagePlay; }
  29.   RandBarPlay;
  30.   BarPlay;
  31.   Bar3DPlay;
  32.   ArcPlay;
  33.   CirclePlay;
  34.   PiePlay;
  35.   LineToPlay;
  36.   LineRelPlay;
  37. {  LineStylePlay; }
  38. {  UserLineStylePlay; }
  39.   TextDump;
  40.   TextPlay;
  41.   CrtModePlay;
  42.   FillStylePlay;
  43.   FillPatternPlay;
  44.   PolyPlay;
  45.   SayGoodbye;
  46. {  CloseGraph; }
  47.   CloseVesa;
  48. end.
  49. ***************************************************
  50.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  51.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  52. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  53. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  54. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  55. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  56.     Color := RandColor;
  57.     SetColor(Color);
  58.     SetFillStyle(Random(CloseDotFill)+1, Color);
  59.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  60.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  61.   until KeyPressed;
  62.   WaitToGo;
  63. end; { RandBarPlay }
  64.  
  65. procedure ArcPlay;
  66. { Draw random arcs on the screen }
  67. var
  68.   MaxRadius : word;
  69.   EndAngle : word;
  70.   ArcInfo : ArcCoordsType;
  71. begin
  72.   MainWindow('Arc / GetArcCoords demonstration');
  73.   StatusLine('Esc aborts or press a key');
  74.   MaxRadius := MaxY div 10;
  75.   repeat
  76.     SetColor(RandColor);
  77.     EndAngle := Random(360);
  78.     SetLineStyle(SolidLn, 0, NormWidth);
  79.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  80.     GetArcCoords(ArcInfo);
  81.     with ArcInfo do
  82.     begin
  83.       Line(X, Y, XStart, YStart);
  84.       Line(X, Y, Xend, Yend);
  85.     end;
  86.   until KeyPressed;
  87.   WaitToGo;
  88. end; { ArcPlay }
  89.  
  90. procedure PutPixelPlay;
  91. { Demonstrate the PutPixel and GetPixel commands }
  92. const
  93.   Seed   = 1962; { A seed for the random number generator }
  94.   NumPts = 2000; { The number of pixels plotted }
  95.   Esc    = #27;
  96. var
  97.   I : word;
  98.   X, Y, Color : word;
  99.   XMax, YMax  : integer;
  100.   ViewInfo    : ViewPortType;
  101. begin
  102.   MainWindow('PutPixel / GetPixel demonstration');
  103.   StatusLine('Esc aborts or press a key...');
  104.  
  105.   GetViewSettings(ViewInfo);
  106.   with ViewInfo do
  107.   begin
  108.     XMax := (x2-x1-1);
  109.     YMax := (y2-y1-1);
  110.   end;
  111.  
  112.   while not KeyPressed do
  113.   begin
  114.     { Plot random pixels }
  115.     RandSeed := Seed;
  116.     I := 0;
  117.     while (not KeyPressed) and (I < NumPts) do
  118.     begin
  119.       Inc(I);
  120.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  121.     end;
  122.  
  123.     { Erase pixels }
  124.     RandSeed := Seed;
  125.     I := 0;
  126.     while (not KeyPressed) and (I < NumPts) do
  127.     begin
  128.       Inc(I);
  129.       X := Random(XMax)+1;
  130.       Y := Random(YMax)+1;
  131.       Color := GetPixel(X, Y);
  132.         if Color = RandColor then
  133.           PutPixel(X, Y, 0);
  134.      end;
  135.   end;
  136.   WaitToGo;
  137. end; { PutPixelPlay }
  138.  
  139. procedure PutImagePlay;
  140. { Demonstrate the GetImage and PutImage commands }
  141.  
  142. const
  143.   r  = 20;
  144.   StartX = 100;
  145.   StartY = 50;
  146.  
  147. var
  148.   CurPort : ViewPortType;
  149.  
  150. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  151. var
  152.   Step : integer;
  153. begin
  154.   Step := Random(2*r);
  155.   if Odd(Step) then
  156.     Step := -Step;
  157.   X := X + Step;
  158.   Step := Random(r);
  159.   if Odd(Step) then
  160.     Step := -Step;
  161.   Y := Y + Step;
  162.  
  163.   { Make saucer bounce off viewport walls }
  164.   with CurPort do
  165.   begin
  166.     if (x1 + X + Width - 1 > x2) then
  167.       X := x2-x1 - Width + 1
  168.     else
  169.       if (X < 0) then
  170.         X := 0;
  171.     if (y1 + Y + Height - 1 > y2) then
  172.       Y := y2-y1 - Height + 1
  173.     else
  174.       if (Y < 0) then
  175.         Y := 0;
  176.   end;
  177. end; { MoveSaucer }
  178.  
  179. var
  180.   Pausetime : word;
  181.   Saucer    : pointer;
  182.   X, Y      : integer;
  183.   ulx, uly  : word;
  184.   lrx, lry  : word;
  185.   Size      : word;
  186.   I         : word;
  187. begin
  188.   ClearDevice;
  189.   FullPort;
  190.  
  191.   { PaintScreen }
  192.   ClearDevice;
  193.   MainWindow('GetImage / PutImage Demonstration');
  194.   StatusLine('Esc aborts or press a key...');
  195.   GetViewSettings(CurPort);
  196.  
  197.   { DrawSaucer }
  198.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  199.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  200.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  201.   Circle(StartX+10, StartY-12, 2);
  202.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  203.   Circle(StartX-10, StartY-12, 2);
  204.   SetFillStyle(SolidFill, MaxColor);
  205.   FloodFill(StartX+1, StartY+4, Ge