Помогите доделать программу.Все готово осталось только закрасить квадрат,но у меня паскаль в полноэкранном режиме не работает.
Код:
Program Graphworld;
Uses Graph, crt;
Type
Location = object
x1,y1,x2,y2 :integer;
constructor Init (initX1, initY1, initX2, inity2 :integer);
destructor Done;
function GetX :integer;
function GetY :integer;
end;
Constructor Location.Init (initX1, initY1, initx2, inity2 :integer);
Begin
X1:=InitX1;
Y1:=InitY1;
x2:=initx2;
y2:=inity2;
End;
Destructor Location.Done;
Begin
End;
Function Location.GetX:integer;
Begin
GetX:=x1;
End;
Function Location.GetY:integer;
Begin
GetY:=y1;
End;
{=======================================================================}
Type Point = object (Location)
visible:boolean;
Procedure Show; virtual;
Procedure Hide; virtual;
Procedure Moveto (newX1, newY1 ,NewX2 ,NewY2 :integer);
End;
Procedure Point.Show;
Begin
Putpixel(x1, y1, Getcolor);
Visible:=TRUE
End;
Procedure Point.Hide;
Begin
Putpixel(x1, y1, GetBkColor);
Visible:=FALSE
End;
Procedure Point.Moveto;
Var TempVisible:boolean;
Begin
TempVisible:=visible;
If TempVisible then Hide;
X1:=newX1;
Y1:=newY1;
X2:=NewX2;
y2:=NewY2 ;
If TempVisible then Show;
End;
{=======================================================================}
Type rect = object (Point)
Constructor Init (initX1, initY1,initX2,InitY2:integer);
Procedure Show; virtual;
Procedure Hide; virtual;
end;
Constructor rect.Init;
Begin
X1:=initX1;
Y1:=initY1;
X2:=InitX2;
Y2:=InitY2;
End;
Procedure rect.Show;
Var tempcolor :word;
Begin
TempColor:=GetBkColor;
SetBKColor(GetColor);
Graph.rectangle(X1,Y1,X2,Y2);
SetBkColor(TempColor);
Visible:=TRUE
End;
Procedure rect.Hide;
Var tempcolor :word;
Begin
Tempcolor:=Getcolor;
Setcolor(Getbkcolor);
Graph.rectangle(x1, y1, x2, y2);
Setcolor(Tempcolor);
Visible:=FALSE
End;
{=============================================================================}
Type World = object
Mode :integer;
Driver :integer;
Procedure Initworld(gdr, gmode :integer; path :string);
Procedure Endworld;
End;
Procedure World.Initworld;
Var rez :integer;
Begin
Driver:=gdr;
Mode:=gmode;
Initgraph(driver, mode, path);
Rez:=Graphresult;
If rez<>GrOK then
Begin
Writeln(GraphErrorMsg(rez));
Halt(1);
End;
End;
Procedure World.Endworld;
Begin
Closegraph;
Writeln('The end of the world.');
End;
Type ppoint = ^point;
prect = ^rect;
function Move(vo:prect;x1,y1,x2,y2:integer):boolean;
var i,j:integer;
getout:boolean;
begin
getout:=false;
repeat
for j:=1 to 300
do begin
vo^.MoveTo(x1,y1+j,x2,y2+j);
delay(1500);
getout:=keypressed;
if getout then break
end;
for i:=1 to 300
do begin
vo^.MoveTo(x1+i,y1+j,x2+i,y2+j);
delay(1500);
getout:=keypressed;
if getout then break
end;
for j:=300 downto 1
do begin
vo^.MoveTo(x1+i,y1+j,x2+i,y2+j);
delay(1500);
getout:=keypressed;
if getout then break
end;
for i:=300 downto 1
do begin
vo^.MoveTo(x1+i,y1+j,x2+i,y2+j);
delay(1500);
getout:=keypressed;
if getout then break
end;
until getout;
end;
Var namepathdriver :string;
W :world;
Pt :ppoint;
Pc :prect;
over:boolean;
Begin
{ инициализация мира }
writeln('Путь к драйверу');
readln(namepathdriver);
w.initworld(detect, detect, namepathdriver);
{ рождение объектов }
pc:=new(prect,init(50,50,150,150));
{ развитие объектов }
pc^.show;
repeat
over:=Move(pc,50,50,100,100);
until over;
readln;
{pt^.moveto(50, 50);
pc^.moveto(250,250);
readln;}
{ смерть объектов }
dispose(pt,done);
dispose(pc,done);
{ конец мира }
w.endworld;
readln;
End.