Пример сохранителя экрана — Pascal(Паскаль)

{$A+,B-,D-,E-,F-,G-,I-,L-,N-,O-,L cga.obj}
{$P-,Q-,R-,S-,T-,V+,X+,M 8192,0,65536}
program Point;
uses Graph, Crt;
type
  Ptype = record
    mx, my : Integer;
    mc : Byte
  end;
var
  p : array [1..100] of Ptype;
  x, y, xm, ym : Integer;
  i, b, c : Byte;

procedure CGADriv; external;

procedure Ust;
var Gd, Gm : Integer;
begin
  if RegisterBGIDriver(@CGADriv)<0 then Halt(1);
  Gd:=CGA; Gm:=Trunc(Random*4); InitGraph(Gd,Gm,'');
  if GraphResult<>GrOk then Halt(1);
  xm:=GetMaxX; ym:=GetMaxY
end;

procedure Pxl;
begin
  x:=Trunc(Random*xm); y:=Trunc(Random*ym);
  c:=Trunc(Random*15)+1; PutPixel(x,y,c);
  PutPixel(x+1,y,c); PutPixel(x,y+1,c); PutPixel(x+1,y+1,c);
  with p[i] do
  begin
    mx:=x; my:=y; mc:=c
  end
end;

begin
  Randomize; Ust; for i:=1 to 100 do Pxl;
  repeat
    i:=Trunc(Random*100)+1;
    with p[i] do
    begin
      x:=mx; y:=my; c:=mc
    end;
    for b:=8 downto 0 do
    begin
      SetColor(0); Circle(x,y,b+1);
      SetColor(c); Circle(x,y,b); Delay(30)
    end;
    SetColor(0); for b:=3 downto 0 do Circle(x,y,b);
    PutPixel(x,y,0); PutPixel(x+1,y,0); PutPixel(x,y+1,0);
    PutPixel(x+1,y+1,0); Pxl
  until KeyPressed;
  CloseGraph; while KeyPressed do ReadKey
end { Point }.

Leave a Comment

67 − 65 =