Changeset 465 for branches/highdpi/LocalPlayer/Wonders.pas
- Timestamp:
- Nov 30, 2023, 10:16:14 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/Wonders.pas
r361 r465 23 23 Selection: Integer; 24 24 Center: TPoint; 25 procedure DarkIcon( i: Integer);26 procedure Glow( i, GlowColor: Integer);25 procedure DarkIcon(I: Integer); 26 procedure Glow(I, GlowColor: Integer); 27 27 procedure PaintBackgroundShape; 28 28 public 29 29 procedure OffscreenPaint; override; 30 procedure ShowNewContent(NewMode: Integer); 31 end; 32 33 var 34 WondersDlg: TWondersDlg; 30 procedure ShowNewContent(NewMode: TWindowMode); 31 end; 35 32 36 33 … … 38 35 39 36 uses 40 Term, ClientTools, Help, Tribes, UPixelPointer;37 Term, ClientTools, Help, Tribes, PixelPointer; 41 38 42 39 {$R *.lfm} … … 76 73 procedure TWondersDlg.FormShow(Sender: TObject); 77 74 begin 75 Caption := Phrases.Lookup('TITLE_WONDERS'); 78 76 Selection := -1; 79 77 OffscreenPaint; 80 78 end; 81 79 82 procedure TWondersDlg.ShowNewContent(NewMode: Integer);80 procedure TWondersDlg.ShowNewContent(NewMode: TWindowMode); 83 81 begin 84 82 inherited ShowNewContent(NewMode); … … 109 107 Height := ScaleToNative(128); 110 108 Offscreen.BeginUpdate; 111 Line[0] := PixelPointer(Offscreen, ScaleToNative(Center.X), ScaleToNative(Center.Y));112 Line[1] := PixelPointer(Offscreen, ScaleToNative(Center.X), ScaleToNative(Center.Y) - 1);113 Line[2] := PixelPointer(Offscreen, ScaleToNative(Center.X) - 1, ScaleToNative(Center.Y));114 Line[3] := PixelPointer(Offscreen, ScaleToNative(Center.X) - 1, ScaleToNative(Center.Y) - 1);109 Line[0] := TPixelPointer.Create(Offscreen, ScaleToNative(Center.X), ScaleToNative(Center.Y)); 110 Line[1] := TPixelPointer.Create(Offscreen, ScaleToNative(Center.X), ScaleToNative(Center.Y) - 1); 111 Line[2] := TPixelPointer.Create(Offscreen, ScaleToNative(Center.X) - 1, ScaleToNative(Center.Y)); 112 Line[3] := TPixelPointer.Create(Offscreen, ScaleToNative(Center.X) - 1, ScaleToNative(Center.Y) - 1); 115 113 for Y := 0 to Height - 1 do begin 116 114 for X := 0 to Width - 1 do begin 117 r:= X * X * ((Height div 4) * (Height div 4)) + Y * Y * ((Width div 4) * (Width div 4));115 R := X * X * ((Height div 4) * (Height div 4)) + Y * Y * ((Width div 4) * (Width div 4)); 118 116 ax := ((1 shl 16 div (Height div 4)) * (Width div 4)) * Y; 119 if ( r< ScaleToNative(8) * Height * Width * Width) and120 (( r>= (Height div 4) * (Height div 2) * (Width div 2) * (Width div 2)) and (ax < amax2 * X) and117 if (R < ScaleToNative(8) * Height * Width * Width) and 118 ((R >= (Height div 4) * (Height div 2) * (Width div 2) * (Width div 2)) and (ax < amax2 * X) and 121 119 ((ax < amax0 * X) or (ax > amin2 * X)) or (ax > amin1 * X) and 122 120 ((ax < amax1 * X) or (ax > amin3 * X))) then begin 123 121 for ch := 0 to 2 do begin 124 c:= Line[0].Pixel^.Planes[ch] - Darken;125 if c< 0 then Line[0].Pixel^.Planes[ch] := 0126 else Line[0].Pixel^.Planes[ch] := c;127 c:= Line[1].Pixel^.Planes[ch] - Darken;128 if c< 0 then Line[1].Pixel^.Planes[ch] := 0129 else Line[1].Pixel^.Planes[ch] := c;130 c:= Line[2].Pixel^.Planes[ch] - Darken;131 if c< 0 then Line[2].Pixel^.Planes[ch] := 0132 else Line[2].Pixel^.Planes[ch] := c;133 c:= Line[3].Pixel^.Planes[ch] - Darken;134 if c< 0 then Line[3].Pixel^.Planes[ch] := 0135 else Line[3].Pixel^.Planes[ch] := c;122 C := Line[0].Pixel^.Planes[ch] - Darken; 123 if C < 0 then Line[0].Pixel^.Planes[ch] := 0 124 else Line[0].Pixel^.Planes[ch] := C; 125 C := Line[1].Pixel^.Planes[ch] - Darken; 126 if C < 0 then Line[1].Pixel^.Planes[ch] := 0 127 else Line[1].Pixel^.Planes[ch] := C; 128 C := Line[2].Pixel^.Planes[ch] - Darken; 129 if C < 0 then Line[2].Pixel^.Planes[ch] := 0 130 else Line[2].Pixel^.Planes[ch] := C; 131 C := Line[3].Pixel^.Planes[ch] - Darken; 132 if C < 0 then Line[3].Pixel^.Planes[ch] := 0 133 else Line[3].Pixel^.Planes[ch] := C; 136 134 end; 137 135 end; … … 149 147 end; 150 148 151 procedure TWondersDlg.DarkIcon( i: Integer);149 procedure TWondersDlg.DarkIcon(I: Integer); 152 150 var 153 X, Y, ch, x0Dst, y0Dst, x0Src, y0Src, darken, c: Integer;151 X, Y, ch, x0Dst, y0Dst, x0Src, y0Src, darken, C: Integer; 154 152 Src, Dst: TPixelPointer; 155 153 begin 156 154 Offscreen.BeginUpdate; 157 x0Dst := ClientWidth div 2 - xSizeBig div 2 + RingPosition[ i].X;158 y0Dst := ClientHeight div 2 - ySizeBig div 2 + RingPosition[ i].Y;159 x0Src := ( imod 7) * xSizeBig;160 y0Src := ( idiv 7 + SystemIconLines) * ySizeBig;161 Src := PixelPointer(BigImp, ScaleToNative(x0Src), ScaleToNative(y0Src));162 Dst := PixelPointer(Offscreen, ScaleToNative(x0Dst), ScaleToNative(y0Dst));155 x0Dst := ClientWidth div 2 - xSizeBig div 2 + RingPosition[I].X; 156 y0Dst := ClientHeight div 2 - ySizeBig div 2 + RingPosition[I].Y; 157 x0Src := (I mod 7) * xSizeBig; 158 y0Src := (I div 7 + SystemIconLines) * ySizeBig; 159 Src := TPixelPointer.Create(BigImp, ScaleToNative(x0Src), ScaleToNative(y0Src)); 160 Dst := TPixelPointer.Create(Offscreen, ScaleToNative(x0Dst), ScaleToNative(y0Dst)); 163 161 for Y := 0 to ScaleToNative(ySizeBig) - 1 do begin 164 162 for X := 0 to ScaleToNative(xSizeBig) - 1 do begin … … 166 164 15 + (255 - Src.Pixel^.R) * 9) div 128; 167 165 for ch := 0 to 2 do begin 168 c:= Dst.Pixel^.Planes[ch] - Darken;169 if c< 0 then Dst.Pixel^.Planes[ch] := 0170 else Dst.Pixel^.Planes[ch] := c;166 C := Dst.Pixel^.Planes[ch] - Darken; 167 if C < 0 then Dst.Pixel^.Planes[ch] := 0 168 else Dst.Pixel^.Planes[ch] := C; 171 169 end; 172 170 Src.NextPixel; … … 179 177 end; 180 178 181 procedure TWondersDlg.Glow( i, GlowColor: Integer);179 procedure TWondersDlg.Glow(I, GlowColor: Integer); 182 180 begin 183 181 GlowFrame(Offscreen, 184 ClientWidth div 2 - xSizeBig div 2 + RingPosition[ i].X,185 ClientHeight div 2 - ySizeBig div 2 + RingPosition[ i].Y,182 ClientWidth div 2 - xSizeBig div 2 + RingPosition[I].X, 183 ClientHeight div 2 - ySizeBig div 2 + RingPosition[I].Y, 186 184 xSizeBig, ySizeBig, GlowColor); 187 185 end; … … 235 233 WonderDestroyed: begin 236 234 HaveWonder := True; 237 DpiBit Canvas(Offscreen.Canvas,235 DpiBitBltCanvas(Offscreen.Canvas, 238 236 Center.X - xSizeBig div 2 + RingPosition[I].X, 239 237 Center.Y - ySizeBig div 2 + RingPosition[I].Y, xSizeBig, … … 243 241 else begin 244 242 HaveWonder := True; 245 DpiBit Canvas(Offscreen.Canvas,243 DpiBitBltCanvas(Offscreen.Canvas, 246 244 Center.X - xSizeBig div 2 + RingPosition[I].X, 247 245 Center.Y - ySizeBig div 2 + RingPosition[I].Y, xSizeBig, ySizeBig, … … 280 278 281 279 MarkUsedOffscreen(ClientWidth, ClientHeight); 282 end; { OffscreenPaint }280 end; 283 281 284 282 procedure TWondersDlg.CloseBtnClick(Sender: TObject); … … 350 348 begin 351 349 if Selection >= 0 then 352 HelpDlg.ShowNewContent(FWindowMode or wmPersistent, hkImp, Selection);350 MainScreen.HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkImp, Selection); 353 351 end; 354 352
Note:
See TracChangeset
for help on using the changeset viewer.