.
uses graph,crt;
const
sizex=30;
sizey=300;
sizexp=25;
sizeyp=15;
speed=1;
one=pi/180;
t=one*speed;
ms=2000;
Type TEllipse=object
f1,f2:real;
angle,xxpp,yypp,xxp,yyp:real;
x,y:integer;
Constructor Init (focus1,focus2:integer; xp,yp:integer);
Procedure show;
procedure rotate (xO,yO:integer;xp:real);
Destructor Done;
end;
TScreen=object(TEllipse)
Constructor Init(focus1,focus2:integer; xp,yp:integer);
Procedure GraphInit;
Procedure Go;
Destructor Done;
end;
Constructor TEllipse.Init(focus1,focus2:integer; xp,yp:integer);
begin
x:=focus1; y:=focus2;
f1:=xp;
f2:=yp;
fillellipse(x,y,round(f1),round(f2));
end;
Procedure TEllipse.Rotate(xO,yO:integer; xp:real);
begin
x:=xo;
y:=yo;
xxpp:=xo+(xp*(cos(t)));
yypp:=yo+(xp*(sin(t)));
fillellipse(x,y,Round(xxpp),Round(yypp));
end;
procedure TEllipse.show;
begin
end;
Destructor TEllipse.Done;
begin end;
Constructor TScreen.Init(focus1,focus2:integer; xp,yp:integer);
begin
x:=focus1;
y:=focus2;
f1:=xp;
f2:=yp;
fillellipse(x,y,round(f1),round(f2));
angle:=0;
end;
Procedure TScreen.GraphInit;
var gd,gm,ErrorCode:integer;
begin
if GetGraphMode=2 then Exit;
gd:=Detect;
InitGraph(gd,gm,'');
ErrorCode:=GraphResult;
if ErrorCode<>grok then begin
writeln('Error: ',GraphErrorMsg(ErrorCode));
Halt(1);
end;
end;
procedure TScreen.Go;
begin
repeat
angle:=angle+t;
rotate(x,y,Round(xxpp));
delay(ms);
show;
until keypressed;
end;
Destructor Tscreen.done;
begin CloseGraph; end;
{$I GrInit}
var Screen:Tscreen;
begin
GRInit;
Screen.Init(sizex,sizey,sizexp,sizeyp);
Screen.GraphInit;
Screen.Go;
Screen.done;
end.
Посмотрите на исходник, где-то ошибка есть, Исходник |