Changeset 269 for trunk/UClientGUI.pas


Ignore:
Timestamp:
Jan 21, 2019, 12:38:20 AM (6 years ago)
Author:
chronos
Message:
  • Added: Map random preview in New game form.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UClientGUI.pas

    r268 r269  
    3030    procedure CenterMap;
    3131    procedure CenterPlayerCity(Player: TPlayer);
     32    procedure ZoomAll;
    3233    function CanvasToCellPos(Pos: TPoint): TPoint;
    3334    function CellToCanvasPos(Pos: TPoint): TPoint;
     
    7677procedure TClientGUI.Paint(Canvas: TCanvas; View: TView);
    7778begin
     79  DrawCellLinks(Canvas, View);
    7880  DrawCells(Canvas, View);
     81  DrawCities(Canvas, View);
     82  DrawSelection(Canvas, View);
     83  DrawArrows(Canvas, View);
    7984  if TGame(Game).DevelMode then DrawNeighborLinks(Canvas, View);
    8085end;
     
    305310  MapCell: TCell;
    306311  CellText: string;
    307   Points: array of Classes.TPoint;
    308   I: Integer;
    309312begin
    310313  with Canvas, View do begin
     
    403406  Cell: TPlayerCell;
    404407  MapCell: TCell;
    405   CellText: string;
    406408  Points: array of Classes.TPoint;
    407409  I: Integer;
     
    454456procedure TClientGUI.DrawSelection(Canvas: TCanvas; View: TView);
    455457var
    456   Cell: TPlayerCell;
    457   MapCell: TCell;
    458   CellText: string;
    459458  Points: array of Classes.TPoint;
    460459  I: Integer;
     
    641640end;
    642641
     642procedure TView.ZoomAll;
     643var
     644  Factor: TPointF;
     645  MapRect: TRect;
     646  NewZoom: Single;
     647begin
     648  MapRect := TGame(Game).Map.CalculatePixelRect;
     649  Factor := TPointF.Create(DestRect.Size.X / MapRect.Size.X,
     650    DestRect.Size.Y / MapRect.Size.Y);
     651  if Factor.X < Factor.Y then NewZoom := Factor.X
     652    else NewZoom := Factor.Y;
     653  if NewZoom = 0 then NewZoom := 1;
     654  Zoom := NewZoom;
     655  CenterMap;
     656end;
     657
    643658function TView.IsCellVisible(Cell: TCell): Boolean;
    644659var
Note: See TracChangeset for help on using the changeset viewer.