Changeset 447 for trunk/LocalPlayer/TechTree.pas
- Timestamp:
- May 19, 2022, 10:39:34 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/TechTree.pas
r426 r447 55 55 yLegendPitch = 32; 56 56 57 function min(a, b: Integer): Integer;58 begin 59 if a < bthen60 result := a57 function Min(A, B: Integer): Integer; 58 begin 59 if A < B then 60 Result := A 61 61 else 62 result := b;63 end; 64 65 function max(a, b: Integer): Integer;66 begin 67 if a > bthen68 result := a62 Result := B; 63 end; 64 65 function Max(A, B: Integer): Integer; 66 begin 67 if A > B then 68 Result := A 69 69 else 70 result := b;70 Result := B; 71 71 end; 72 72 … … 84 84 procedure TTechTreeDlg.FormPaint(Sender: TObject); 85 85 var 86 X, w: Integer;86 X, W: Integer; 87 87 begin 88 88 with Canvas do begin 89 89 // black border 90 brush.color := $000000;91 fillrect(rect(0, 0, BlackBorder, ClientHeight));92 fillrect(rect(BlackBorder, 0, ClientWidth - BlackBorder, BlackBorder));93 fillrect(rect(ClientWidth - BlackBorder, 0, ClientWidth, ClientHeight));94 fillrect(rect(BlackBorder, ClientHeight - BlackBorder,90 Brush.Color := $000000; 91 FillRect(rect(0, 0, BlackBorder, ClientHeight)); 92 FillRect(rect(BlackBorder, 0, ClientWidth - BlackBorder, BlackBorder)); 93 FillRect(rect(ClientWidth - BlackBorder, 0, ClientWidth, ClientHeight)); 94 FillRect(rect(BlackBorder, ClientHeight - BlackBorder, 95 95 ClientWidth - BlackBorder, ClientHeight)); 96 96 97 97 // texturize empty space 98 brush.color := $FFFFFF;98 Brush.Color := $FFFFFF; 99 99 if xOffset > 0 then 100 100 FillRectSeamless(Canvas, BlackBorder, BlackBorder, BlackBorder + xOffset, … … 105 105 ClientWidth - BlackBorder, ClientHeight - BlackBorder, 106 106 -BlackBorder - xOffset, -BlackBorder - yOffset, Paper); 107 X := max(BlackBorder, BlackBorder + xOffset);108 w := min(BlackBorder + xOffset + Image.width, ClientWidth - BlackBorder);107 X := Max(BlackBorder, BlackBorder + xOffset); 108 W := Min(BlackBorder + xOffset + Image.width, ClientWidth - BlackBorder); 109 109 if yOffset > 0 then 110 FillRectSeamless(Canvas, X, BlackBorder, w, BlackBorder + yOffset,110 FillRectSeamless(Canvas, X, BlackBorder, W, BlackBorder + yOffset, 111 111 -BlackBorder - xOffset, -BlackBorder - yOffset, Paper); 112 112 if yOffset + Image.height < ClientHeight - 2 * BlackBorder then 113 FillRectSeamless(Canvas, X, BlackBorder + yOffset + Image.height, w,113 FillRectSeamless(Canvas, X, BlackBorder + yOffset + Image.height, W, 114 114 ClientHeight - BlackBorder, -BlackBorder - xOffset, 115 115 -BlackBorder - yOffset, Paper); 116 116 end; 117 BitBltCanvas(Canvas, max(BlackBorder, BlackBorder + xOffset),118 max(BlackBorder, BlackBorder + yOffset),119 min(Image.width, min(Image.width + xOffset,120 min(ClientWidth - 2 * BlackBorder, ClientWidth - 2 * BlackBorder - xOffset))121 ), min(Image.height, min(Image.height + yOffset,122 min(ClientHeight - 2 * BlackBorder, ClientHeight - 2 * BlackBorder -123 yOffset))), Image.Canvas, max(0, -xOffset),124 max(0, -yOffset));117 BitBltCanvas(Canvas, Max(BlackBorder, BlackBorder + xOffset), 118 Max(BlackBorder, BlackBorder + yOffset), 119 Min(Image.width, Min(Image.width + xOffset, 120 Min(ClientWidth - 2 * BlackBorder, ClientWidth - 2 * BlackBorder - xOffset)) 121 ), Min(Image.height, Min(Image.height + yOffset, 122 Min(ClientHeight - 2 * BlackBorder, ClientHeight - 2 * BlackBorder - 123 yOffset))), Image.Canvas, Max(0, -xOffset), 124 Max(0, -yOffset)); 125 125 end; 126 126 … … 128 128 var 129 129 X, Y, ad: Integer; 130 s: string;130 S: string; 131 131 NewWidth: Integer; 132 132 NewHeight: Integer; … … 142 142 // write advance names 143 143 Font.Assign(UniFont[ftSmall]); 144 Font. color := clBlack;145 brush.Style := bsClear;144 Font.Color := clBlack; 145 Brush.Style := bsClear; 146 146 for X := 0 to (Image.width - xStart) div xPitch do 147 147 for Y := 0 to (Image.height - yStart) div yPitch do … … 150 150 if ad and $FFFF00 = 0 then 151 151 begin 152 s:= Phrases.Lookup('ADVANCES', ad);153 while TextWidth( s) > 112 do154 Delete( s, Length(s), 1);155 TextOut(xStart + X * xPitch + 2, yStart + Y * yPitch, s);152 S := Phrases.Lookup('ADVANCES', ad); 153 while TextWidth(S) > 112 do 154 Delete(S, Length(S), 1); 155 TextOut(xStart + X * xPitch + 2, yStart + Y * yPitch, S); 156 156 Pixels[xStart + X * xPitch + 10, yStart + Y * yPitch - 1] 157 157 := TransparentColor2; … … 191 191 if Button = mbLeft then 192 192 begin 193 dragging := true;193 dragging := True; 194 194 xDown := X; 195 195 yDown := Y; … … 200 200 Shift: TShiftState; X, Y: Integer); 201 201 begin 202 dragging := false;202 dragging := False; 203 203 end; 204 204
Note:
See TracChangeset
for help on using the changeset viewer.