1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51:
| procedure TSpielfeld.Init(color : TColor); var m,n,o,p : Integer; begin BackgroundColor := color;
with Hintergrund do begin Canvas.Pen.Color := BackgroundColor; Canvas.Brush.Color := BackgroundColor; Canvas.Rectangle(0,0,width,height); end; Temp.Canvas.Draw(0,0,Hintergrund);
m := (self.Width DIV 20) -1; n := (self.Height DIV 20) -1; SetLength(Struktur,m,n); for o := 0 to m do for p := 0 to n do begin Struktur[o,p].X := 0; Struktur[o,p].Y := 0; end;
end;
procedure TSpielfeld.SetSize(Size: TPoint); begin self.Width := Size.X; self.Height := Size.Y;
Temp.Width := Size.X; Temp.Height := Size.Y;
Hintergrund.Width := Size.X; Hintergrund.Height := Size.Y; end;
function TSpielfeld.CorrectMapSize(Mapsize: TPoint) : TPoint; var temp : TPoint; begin temp := Mapsize; if temp.X > 1280 then temp.X := 1280; if temp.Y > 800 then temp.Y := 800 ; if (temp.X MOD 20) <> 0 then temp.X := temp.X - ((temp.X MOD 20) * 20); if (temp.Y MOD 20) <> 0 then temp.Y := temp.Y - ((temp.Y MOD 20) * 20);
result := temp; end; |