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/Forms/UFormClient.pas

    r268 r269  
    106106  FormClient: TFormClient;
    107107
     108const
     109  MapBackgroundColor = $404040;
     110
    108111implementation
    109112
     
    180183  X, Y: Integer;
    181184  TempView: TView;
    182 const
    183   BackgroundColor = $404040;
    184185begin
    185186  DrawStart := Now;
     
    189190    if csOpaque in PaintBox1.ControlStyle then begin
    190191      TempBitmap.SetSize(PaintBox1.Width, PaintBox1.Height);
    191       TempBitmap.Canvas.Brush.Color := BackGroundColor; //clBackground; //PaintBox1.GetColorResolvingParent;
     192      TempBitmap.Canvas.Brush.Color := MapBackGroundColor; //clBackground; //PaintBox1.GetColorResolvingParent;
    192193      TempBitmap.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height);
    193194      Client.Paint(TempBitmap.Canvas, View);
     
    238239              )
    239240            );
    240             Client.Paint(PaintBox1.Canvas, TempView);
     241            Client.DrawCells(PaintBox1.Canvas, TempView);
    241242          end;
    242243        end;
     
    291292        end;
    292293      end else begin
    293         Client.DrawCellLinks(PaintBox1.Canvas, View);
    294294        Client.Paint(PaintBox1.Canvas, View);
    295         Client.DrawCities(PaintBox1.Canvas, View);
    296         Client.DrawSelection(PaintBox1.Canvas, View);
    297         Client.DrawArrows(PaintBox1.Canvas, View);
    298295      end;
    299296    end;
     
    436433
    437434procedure TFormClient.AZoomAllExecute(Sender: TObject);
    438 var
    439   Factor: TPointF;
    440   MapRect: TRect;
    441   NewZoom: Single;
    442435begin
    443436  with Core, Game, Client, View do begin
    444     MapRect := Map.CalculatePixelRect;
    445     Factor := TPointF.Create(DestRect.Size.X / MapRect.Size.X,
    446       DestRect.Size.Y / MapRect.Size.Y);
    447     if Factor.X < Factor.Y then NewZoom := Factor.X
    448       else NewZoom := Factor.Y;
    449     if NewZoom = 0 then NewZoom := 1;
    450     Zoom := NewZoom;
    451     CenterMap;
     437    ZoomAll;
    452438  end;
    453439  Redraw;
Note: See TracChangeset for help on using the changeset viewer.