Ignore:
Timestamp:
Nov 30, 2023, 10:16:14 PM (5 months ago)
Author:
chronos
Message:
  • Modified: Updated high dpi branch from trunk.
  • Modified: Use generics.collections instead of fgl.
  • Modified: Compile with Delphi syntax.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/LocalPlayer/Wonders.pas

    r361 r465  
    2323    Selection: Integer;
    2424    Center: TPoint;
    25     procedure DarkIcon(i: Integer);
    26     procedure Glow(i, GlowColor: Integer);
     25    procedure DarkIcon(I: Integer);
     26    procedure Glow(I, GlowColor: Integer);
    2727    procedure PaintBackgroundShape;
    2828  public
    2929    procedure OffscreenPaint; override;
    30     procedure ShowNewContent(NewMode: Integer);
    31   end;
    32 
    33 var
    34   WondersDlg: TWondersDlg;
     30    procedure ShowNewContent(NewMode: TWindowMode);
     31  end;
    3532
    3633
     
    3835
    3936uses
    40   Term, ClientTools, Help, Tribes, UPixelPointer;
     37  Term, ClientTools, Help, Tribes, PixelPointer;
    4138
    4239{$R *.lfm}
     
    7673procedure TWondersDlg.FormShow(Sender: TObject);
    7774begin
     75  Caption := Phrases.Lookup('TITLE_WONDERS');
    7876  Selection := -1;
    7977  OffscreenPaint;
    8078end;
    8179
    82 procedure TWondersDlg.ShowNewContent(NewMode: Integer);
     80procedure TWondersDlg.ShowNewContent(NewMode: TWindowMode);
    8381begin
    8482  inherited ShowNewContent(NewMode);
     
    109107  Height := ScaleToNative(128);
    110108  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);
    115113  for Y := 0 to Height - 1 do begin
    116114    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));
    118116      ax := ((1 shl 16 div (Height div 4)) * (Width div 4)) * Y;
    119       if (r < ScaleToNative(8) * Height * Width * Width) and
    120         ((r >= (Height div 4) * (Height div 2) * (Width div 2) * (Width div 2)) and (ax < amax2 * X) and
     117      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
    121119        ((ax < amax0 * X) or (ax > amin2 * X)) or (ax > amin1 * X) and
    122120        ((ax < amax1 * X) or (ax > amin3 * X))) then begin
    123121        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] := 0
    126             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] := 0
    129             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] := 0
    132             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] := 0
    135             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;
    136134        end;
    137135      end;
     
    149147end;
    150148
    151 procedure TWondersDlg.DarkIcon(i: Integer);
     149procedure TWondersDlg.DarkIcon(I: Integer);
    152150var
    153   X, Y, ch, x0Dst, y0Dst, x0Src, y0Src, darken, c: Integer;
     151  X, Y, ch, x0Dst, y0Dst, x0Src, y0Src, darken, C: Integer;
    154152  Src, Dst: TPixelPointer;
    155153begin
    156154  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 := (i mod 7) * xSizeBig;
    160   y0Src := (i div 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));
    163161  for Y := 0 to ScaleToNative(ySizeBig) - 1 do begin
    164162    for X := 0 to ScaleToNative(xSizeBig) - 1 do begin
     
    166164        15 + (255 - Src.Pixel^.R) * 9) div 128;
    167165      for ch := 0 to 2 do begin
    168         c := Dst.Pixel^.Planes[ch] - Darken;
    169         if c < 0 then Dst.Pixel^.Planes[ch] := 0
    170           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;
    171169      end;
    172170      Src.NextPixel;
     
    179177end;
    180178
    181 procedure TWondersDlg.Glow(i, GlowColor: Integer);
     179procedure TWondersDlg.Glow(I, GlowColor: Integer);
    182180begin
    183181  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,
    186184    xSizeBig, ySizeBig, GlowColor);
    187185end;
     
    235233        WonderDestroyed: begin
    236234          HaveWonder := True;
    237           DpiBitCanvas(Offscreen.Canvas,
     235          DpiBitBltCanvas(Offscreen.Canvas,
    238236            Center.X - xSizeBig div 2 + RingPosition[I].X,
    239237            Center.Y - ySizeBig div 2 + RingPosition[I].Y, xSizeBig,
     
    243241        else begin
    244242          HaveWonder := True;
    245           DpiBitCanvas(Offscreen.Canvas,
     243          DpiBitBltCanvas(Offscreen.Canvas,
    246244            Center.X - xSizeBig div 2 + RingPosition[I].X,
    247245            Center.Y - ySizeBig div 2 + RingPosition[I].Y, xSizeBig, ySizeBig,
     
    280278
    281279  MarkUsedOffscreen(ClientWidth, ClientHeight);
    282 end; { OffscreenPaint }
     280end;
    283281
    284282procedure TWondersDlg.CloseBtnClick(Sender: TObject);
     
    350348begin
    351349  if Selection >= 0 then
    352     HelpDlg.ShowNewContent(FWindowMode or wmPersistent, hkImp, Selection);
     350    MainScreen.HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkImp, Selection);
    353351end;
    354352
Note: See TracChangeset for help on using the changeset viewer.