home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / turbo5 / bgiexamp.arc / SETASP.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-08-29  |  820 b   |  32 lines

  1. { Example for SetAspectRatio }
  2.  
  3. uses
  4.   Crt, Graph;
  5. const
  6.   R = 50;
  7. var
  8.   Driver, Mode : Integer;
  9.   Xasp, Yasp : Word;
  10. begin
  11.   DirectVideo := false;
  12.   Driver := Detect;                    { Put in graphics mode }
  13.   InitGraph(Driver, Mode, '');
  14.   if GraphResult < 0 then
  15.     Halt(1);
  16.   GetAspectRatio(Xasp, Yasp);          { Get default aspect ratio }
  17.   { adjust for VGA and 8514, they have 1:1 aspect }
  18.   if Xasp = Yasp then
  19.     Yasp := 5 * Xasp;
  20.   { Keep modifying aspect ratio until 1:1 or a key is pressed }
  21.   while (Xasp < Yasp) and not KeyPressed do
  22.   begin
  23.     SetAspectRatio(Xasp, Yasp);
  24.     Circle(GetMaxX div 2, GetMaxY div 2, R);
  25.     Inc(Xasp, 20);
  26.   end;
  27.   SetTextJustify(CenterText, CenterText);
  28.   OutTextXY(GetMaxX div 2, GetMaxY div 2, 'Done!');
  29.   Readln;
  30.   Closegraph;
  31. end.
  32.