Ignore:
Timestamp:
May 7, 2020, 7:05:57 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code in HighDPI branch.
Location:
branches/highdpi/LocalPlayer
Files:
12 edited

Legend:

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

    r179 r193  
    212212    OKBtn.Visible := true;
    213213    CancelBtn.Visible := true;
    214     Left := (Screen.Width - ClientWidth) div 2; // center on screen
    215     Top := (Screen.Height - ClientHeight) div 2;
     214    Left := (DpiScreen.Width - ClientWidth) div 2; // center on screen
     215    Top := (DpiScreen.Height - ClientHeight) div 2;
    216216  end
    217217  else
  • branches/highdpi/LocalPlayer/CityScreen.pas

    r179 r193  
    11061106  if WindowMode = wmModal then
    11071107  begin { center on screen }
    1108     Left := (Screen.Width - Width) div 2;
    1109     Top := (Screen.Height - Height) div 2;
     1108    Left := (DpiScreen.Width - Width) div 2;
     1109    Top := (DpiScreen.Height - Height) div 2;
    11101110  end;
    11111111
  • branches/highdpi/LocalPlayer/Diagram.pas

    r178 r193  
    293293  if WindowMode = wmModal then
    294294  begin { center on screen }
    295     Left := (Screen.Width - Width) div 2;
    296     Top := (Screen.Height - Height) div 2;
     295    Left := (DpiScreen.Width - Width) div 2;
     296    Top := (DpiScreen.Height - Height) div 2;
    297297  end;
    298298  OffscreenPaint;
  • branches/highdpi/LocalPlayer/Draft.pas

    r179 r193  
    488488  if WindowMode = wmModal then
    489489  begin { center on screen }
    490     Left := (Screen.Width - Template.Width) div 2;
    491     Top := (Screen.Height - (Template.Height - Cut)) div 2;
     490    Left := (DpiScreen.Width - Template.Width) div 2;
     491    Top := (DpiScreen.Height - (Template.Height - Cut)) div 2;
    492492  end;
    493493
  • branches/highdpi/LocalPlayer/Help.lfm

    r69 r193  
    11object HelpDlg: THelpDlg
    22  Left = 394
     3  Height = 718
    34  Top = 180
     5  Width = 840
    46  BorderIcons = []
    57  BorderStyle = bsNone
    6   ClientHeight = 479
    7   ClientWidth = 560
     8  ClientHeight = 718
     9  ClientWidth = 840
    810  Color = clBtnFace
    9   Font.Charset = DEFAULT_CHARSET
     11  DesignTimePPI = 144
    1012  Font.Color = clWindowText
    11   Font.Height = -13
     13  Font.Height = -20
    1214  Font.Name = 'MS Sans Serif'
    13   Font.Style = []
    1415  FormStyle = fsStayOnTop
    1516  OnClose = FormClose
     
    1718  OnDestroy = FormDestroy
    1819  OnKeyDown = FormKeyDown
    19   OnMouseWheel = FormMouseWheel
    2020  OnMouseDown = PaintBox1MouseDown
    2121  OnMouseMove = PaintBox1MouseMove
     22  OnMouseWheel = FormMouseWheel
    2223  OnPaint = FormPaint
    23   PixelsPerInch = 96
     24  LCLVersion = '2.0.8.0'
    2425  object CloseBtn: TButtonB
    25     Left = 522
    26     Top = 6
    27     Width = 25
    28     Height = 25
     26    Left = 783
     27    Height = 38
     28    Top = 9
     29    Width = 38
    2930    Down = False
    3031    Permanent = False
     
    3334  end
    3435  object BackBtn: TButtonB
    35     Left = 42
    36     Top = 6
    37     Width = 25
    38     Height = 25
     36    Left = 63
     37    Height = 38
     38    Top = 9
     39    Width = 38
    3940    Down = False
    4041    Permanent = False
     
    4344  end
    4445  object TopBtn: TButtonB
    45     Left = 13
    46     Top = 6
    47     Width = 25
    48     Height = 25
     46    Left = 20
     47    Height = 38
     48    Top = 9
     49    Width = 38
    4950    Down = False
    5051    Permanent = False
     
    5354  end
    5455  object SearchBtn: TButtonB
    55     Left = 493
    56     Top = 6
    57     Width = 25
    58     Height = 25
     56    Left = 740
     57    Height = 38
     58    Top = 9
     59    Width = 38
    5960    Down = False
    6061    Permanent = False
  • branches/highdpi/LocalPlayer/Help.pas

    r179 r193  
    367367  ImpPtr: array [-1 .. 1] of TPixelPointer;
    368368begin
     369  { TODO
    369370  // assume eiffel tower has free common heaven
    370371  for dy := 0 to nHeaven - 1 do
     
    376377  xSrc := iix mod 7 * xSizeBig;
    377378  ySrc := (iix div 7 + 1) * ySizeBig;
    378   for y := 0 to ySizeBig * 2 - 1 do
     379  for y := 0 to ScaleToVcl(ySizeBig * 2) - 1 do
    379380    if ((y0 + y) >= 0) and ((y0 + y) < InnerHeight) then begin
    380       PaintPtr.Init(OffScreen, 0, y0 + y);
    381       CoalPtr.Init(Templates, 0, yCoal + y);
     381      PaintPtr.Init(OffScreen, 0, ScaleToVcl(y0 + y));
     382      CoalPtr.Init(Templates, 0, ScaleToVcl(yCoal + y));
    382383      for dy := -1 to 1 do
    383384        if ((Max(y + dy, 0) shr 1) >= 0) and ((Max(y + dy, 0) shr 1) < ySizeBig) then
    384           ImpPtr[dy].Init(BigImp, 0, ySrc + (Max(y + dy, 0) shr 1));
    385       for x := 0 to xSizeBig * 2 - 1 do begin
     385          ImpPtr[dy].Init(BigImp, 0, ScaleToVcl(ySrc + (Max(y + dy, 0) shr 1)));
     386      for x := 0 to ScaleToVcl(xSizeBig * 2) - 1 do begin
    386387        sum := 0;
    387388        for dx := -1 to 1 do begin
     
    412413  Offscreen.EndUpdate;
    413414  BigImp.EndUpdate;
     415  }
    414416end;
    415417
  • branches/highdpi/LocalPlayer/MessgEx.pas

    r179 r193  
    177177    0:
    178178      begin
    179         Left := (Screen.Width - ClientWidth) div 2;
    180         Top := (Screen.Height - ClientHeight) div 2 - MapCenterUp;
     179        Left := (DpiScreen.Width - ClientWidth) div 2;
     180        Top := (DpiScreen.Height - ClientHeight) div 2 - MapCenterUp;
    181181      end;
    182182    1:
    183183      begin
    184         Left := (Screen.Width - ClientWidth) div 4;
    185         Top := (Screen.Height - ClientHeight) * 2 div 3 - MapCenterUp;
     184        Left := (DpiScreen.Width - ClientWidth) div 4;
     185        Top := (DpiScreen.Height - ClientHeight) * 2 div 3 - MapCenterUp;
    186186      end;
    187187    -1:
    188188      begin
    189         Left := (Screen.Width - ClientWidth) div 4;
    190         Top := (Screen.Height - ClientHeight) div 3 - MapCenterUp;
     189        Left := (DpiScreen.Width - ClientWidth) div 4;
     190        Top := (DpiScreen.Height - ClientHeight) div 3 - MapCenterUp;
    191191      end;
    192192  end;
  • branches/highdpi/LocalPlayer/Rates.pas

    r179 r193  
    4242procedure TRatesDlg.FormCreate(Sender: TObject);
    4343begin
    44   TitleHeight := Screen.Height;
     44  TitleHeight := DpiScreen.Height;
    4545  InitButtons();
    4646end;
  • branches/highdpi/LocalPlayer/Select.pas

    r179 r193  
    16091609  begin { center on screen }
    16101610    if Kind = kTribe then
    1611       Left := (Screen.Width - 800) * 3 div 8 + 130
     1611      Left := (DpiScreen.Width - 800) * 3 div 8 + 130
    16121612    else
    1613       Left := (Screen.Width - Width) div 2;
    1614     Top := (Screen.Height - Height) div 2;
     1613      Left := (DpiScreen.Width - Width) div 2;
     1614    Top := (DpiScreen.Height - Height) div 2;
    16151615    if Kind = kProject then
    16161616      Top := Top + 48;
  • branches/highdpi/LocalPlayer/TechTree.pas

    r179 r193  
    183183
    184184  // fit window to image, center image in window, center window to screen
    185   width := min(Screen.width - 40, Image.width + LeftBorder + RightBorder + 2 *
     185  width := min(DpiScreen.width - 40, Image.width + LeftBorder + RightBorder + 2 *
    186186    BlackBorder);
    187   height := min(Screen.height - 40, Image.height + TopBorder + BottomBorder + 2
     187  height := min(DpiScreen.height - 40, Image.height + TopBorder + BottomBorder + 2
    188188    * BlackBorder);
    189   Left := (Screen.width - width) div 2;
    190   Top := (Screen.height - height) div 2;
     189  Left := (DpiScreen.width - width) div 2;
     190  Top := (DpiScreen.height - height) div 2;
    191191  CloseBtn.Left := width - CloseBtn.width - BlackBorder - 8;
    192192  CloseBtn.Top := BlackBorder + 8;
  • branches/highdpi/LocalPlayer/Term.pas

    r179 r193  
    25032503          SetMainTextureByAge(-1);
    25042504        Tribes.Init;
    2505         HelpDlg.UserLeft := (Screen.width - HelpDlg.width) div 2;
    2506         HelpDlg.UserTop := (Screen.height - HelpDlg.height) div 2;
     2505        HelpDlg.UserLeft := (DpiScreen.width - HelpDlg.width) div 2;
     2506        HelpDlg.UserTop := (DpiScreen.height - HelpDlg.height) div 2;
    25072507        HelpDlg.Difficulty := 0;
    25082508        if Command = cStartCredits then
     
    25662566        ListDlg.UserLeft := 8;
    25672567        ListDlg.UserTop := TopBarHeight + 8;
    2568         HelpDlg.UserLeft := Screen.width - HelpDlg.width - 8;
     2568        HelpDlg.UserLeft := DpiScreen.width - HelpDlg.width - 8;
    25692569        HelpDlg.UserTop := TopBarHeight + 8;
    25702570        UnitStatDlg.UserLeft := 397;
    25712571        UnitStatDlg.UserTop := TopBarHeight + 64;
    2572         DiaDlg.UserLeft := (Screen.width - DiaDlg.width) div 2;
    2573         DiaDlg.UserTop := (Screen.height - DiaDlg.height) div 2;
    2574         NatStatDlg.UserLeft := Screen.width - NatStatDlg.width - 8;
    2575         NatStatDlg.UserTop := Screen.height - PanelHeight -
     2572        DiaDlg.UserLeft := (DpiScreen.width - DiaDlg.width) div 2;
     2573        DiaDlg.UserTop := (DpiScreen.height - DiaDlg.height) div 2;
     2574        NatStatDlg.UserLeft := DpiScreen.width - NatStatDlg.width - 8;
     2575        NatStatDlg.UserTop := DpiScreen.height - PanelHeight -
    25762576          NatStatDlg.height - 8;
    25772577        if NatStatDlg.UserTop < 8 then
     
    39083908      UnitStatDlg.Close;
    39093909  end;
    3910   for i := 0 to Screen.FormCount - 1 do
     3910  for i := 0 to DpiScreen.FormCount - 1 do
    39113911    if DpiScreen.Forms[i].Visible and (DpiScreen.Forms[i] is TBufferedDrawDlg) then
    39123912      DpiScreen.Forms[i].Enabled := false;
     
    51025102        dx := 0;
    51035103        dy := 0;
    5104         if Mouse.CursorPos.y < Screen.height - PanelHeight then
     5104        if Mouse.CursorPos.y < DpiScreen.height - PanelHeight then
    51055105          if Mouse.CursorPos.x = 0 then
    51065106            dx := -speed // scroll left
    5107           else if Mouse.CursorPos.x = Screen.width - 1 then
     5107          else if Mouse.CursorPos.x = DpiScreen.width - 1 then
    51085108            dx := speed; // scroll right
    51095109        if Mouse.CursorPos.y = 0 then
    51105110          dy := -speed // scroll up
    5111         else if (Mouse.CursorPos.y = Screen.height - 1) and
     5111        else if (Mouse.CursorPos.y = DpiScreen.height - 1) and
    51125112          (Mouse.CursorPos.x >= TerrainBtn.Left + TerrainBtn.width) and
    51135113          (Mouse.CursorPos.x < xRightPanel + 10 - 8) then
     
    54695469      if BattleDlg.Left < 0 then
    54705470        BattleDlg.Left := 0
    5471       else if BattleDlg.Left + BattleDlg.width > Screen.width then
    5472         BattleDlg.Left := Screen.width - BattleDlg.width;
     5471      else if BattleDlg.Left + BattleDlg.width > DpiScreen.width then
     5472        BattleDlg.Left := DpiScreen.width - BattleDlg.width;
    54735473      BattleDlg.Top := y - BattleDlg.height div 2;
    54745474      if BattleDlg.Top < 0 then
    54755475        BattleDlg.Top := 0
    5476       else if BattleDlg.Top + BattleDlg.height > Screen.height then
    5477         BattleDlg.Top := Screen.height - BattleDlg.height;
     5476      else if BattleDlg.Top + BattleDlg.height > DpiScreen.height then
     5477        BattleDlg.Top := DpiScreen.height - BattleDlg.height;
    54785478      BattleDlg.IsSuicideQuery := false;
    54795479      BattleDlg.Show;
  • branches/highdpi/LocalPlayer/UnitStat.pas

    r179 r193  
    7474  inherited;
    7575  AgePrepared := -2;
    76   TitleHeight := Screen.Height;
     76  TitleHeight := DpiScreen.Height;
    7777  InitButtons();
    7878
     
    171171  else
    172172  begin
    173     Left := (Screen.Width - Width) div 2;
    174     Top := (Screen.Height - Height) div 2;
     173    Left := (DpiScreen.Width - Width) div 2;
     174    Top := (DpiScreen.Height - Height) div 2;
    175175  end;
    176176
Note: See TracChangeset for help on using the changeset viewer.