hedgewars/uLandGraphics.pas
changeset 7147 11b7b12e2b85
parent 7035 823caba67738
child 7150 fba3b14ff746
equal deleted inserted replaced
7145:1d1a14b39400 7147:11b7b12e2b85
    37 procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt);
    37 procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt);
    38 procedure FillRoundInLand(X, Y, Radius: LongInt; Value: Longword);
    38 procedure FillRoundInLand(X, Y, Radius: LongInt; Value: Longword);
    39 procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet: boolean);
    39 procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet: boolean);
    40 function  LandBackPixel(x, y: LongInt): LongWord;
    40 function  LandBackPixel(x, y: LongInt): LongWord;
    41 procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword);
    41 procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword);
       
    42 procedure DrawThickLine(X1, Y1, X2, Y2, radius: LongInt; color: Longword);
    42 
    43 
    43 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean;
    44 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean;
    44 
    45 
    45 implementation
    46 implementation
    46 uses SDLh, uLandTexture, uVariables, uUtils, uDebug;
    47 uses SDLh, uLandTexture, uVariables, uUtils, uDebug;
  1054     if ((x and LAND_WIDTH_MASK) = 0) and ((y and LAND_HEIGHT_MASK) = 0) then
  1055     if ((x and LAND_WIDTH_MASK) = 0) and ((y and LAND_HEIGHT_MASK) = 0) then
  1055         Land[y, x]:= Color;
  1056         Land[y, x]:= Color;
  1056     end
  1057     end
  1057 end;
  1058 end;
  1058 
  1059 
       
  1060 procedure DrawLines(X1, Y1, X2, Y2, dx, dy: LongInt; color: Longword);
       
  1061 begin
       
  1062 DrawLine(x1 + dx, y1 + dy, x2 + dx, y2 + dy, color);
       
  1063 DrawLine(x1 + dx, y1 - dy, x2 + dx, y2 - dy, color);
       
  1064 DrawLine(x1 - dx, y1 + dy, x2 - dx, y2 + dy, color);
       
  1065 DrawLine(x1 - dx, y1 - dy, x2 - dx, y2 - dy, color);
       
  1066 
       
  1067 DrawLine(x1 + dy, y1 + dx, x2 + dy, y2 + dx, color);
       
  1068 DrawLine(x1 + dy, y1 - dx, x2 + dy, y2 - dx, color);
       
  1069 DrawLine(x1 - dy, y1 + dx, x2 - dy, y2 + dx, color);
       
  1070 DrawLine(x1 - dy, y1 - dx, x2 - dy, y2 - dx, color);
       
  1071 end;
       
  1072 
       
  1073 procedure DrawThickLine(X1, Y1, X2, Y2, radius: LongInt; color: Longword);
       
  1074 var dx, dy, d: LongInt;
       
  1075 begin
       
  1076     dx:= 0;
       
  1077     dy:= Radius;
       
  1078     d:= 3 - 2 * Radius;
       
  1079     while (dx < dy) do
       
  1080         begin
       
  1081         DrawLines(x1, y1, x2, y2, dx, dy, color);
       
  1082         if (d < 0) then
       
  1083             d:= d + 4 * dx + 6
       
  1084         else
       
  1085             begin
       
  1086             d:= d + 4 * (dx - dy) + 10;
       
  1087             dec(dy)
       
  1088             end;
       
  1089         inc(dx)
       
  1090         end;
       
  1091     if (dx = dy) then
       
  1092         DrawLines(x1, y1, x2, y2, dx, dy, color);
       
  1093 end;
       
  1094 
  1059 end.
  1095 end.