Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program AppExample;
- uses graph, crt, graphobj;
- type
- Tapplication = object
- procedure init;
- procedure run;
- procedure done;
- end;
- var
- application : Tapplication;
- p : ppoint;
- c : tcircle;
- procedure Tapplication.init;
- var
- d,r,maxx,maxy : integer;
- begin
- d:=detect;
- initGraph(d,r,'C:\BP');
- setbkcolor(white);
- cleardevice;
- maxx:=getmaxx;
- maxy:=getmaxy;
- randomize;
- new(p,init(random(maxx),random(maxy),red));
- p^.show;
- c.Init(random(maxx-40)+20,random(maxy-40)+20,20,blue);
- c.show
- end;
- procedure tapplication.run;
- var
- maxx, maxy : integer;
- begin
- maxx := getmaxx;
- maxy := getmaxy;
- repeat
- p^.moveto(random(maxx),random(maxy));
- c.moveto(random(maxx-40)+20,random(maxy-40)+20);
- delay(500)
- until keypressed
- end;
- procedure tapplication.done;
- begin
- dispose(p,done);
- c.done;
- closegraph
- end;
- begin
- application.init;
- application.run;
- application.done
- end.
Add Comment
Please, Sign In to add comment