Language:
Русский
English
{Setasprt.PAS}
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
{Sample code for the SetAspectRatio procedure.}
uses Crt, Graph;
const R = 50;
var
Driver, Mode: Integer;
Xasp, Yasp: Word;
begin
DirectVideo := False;
Driver := Detect; { Put in graphics mode }
InitGraph(Driver, Mode, '');
if GraphResult < 0 then
Halt(1);
GetAspectRatio(Xasp, Yasp); { Get default aspect ratio }
if Xasp = Yasp then
{ Adjust for VGA and 8514. They have 1:1 aspect }
Yasp := 5 * Xasp;
while (Xasp < Yasp) and not KeyPressed do
{ Keep modifying aspect ratio until 1:1 or key is pressed }
begin
SetAspectRatio(Xasp, Yasp);
Circle(GetMaxX div 2, GetMaxY div 2, R);
Inc(Xasp, 20);
end;
SetTextJustify(CenterText, CenterText);
OutTextXY(GetMaxX div 2, GetMaxY div 2, 'Done!');
Readln;
CloseGraph;
end.