Changeset 268 for trunk/UClientGUI.pas
- Timestamp:
- Jan 20, 2019, 9:32:16 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UClientGUI.pas
r267 r268 48 48 public 49 49 View: TView; 50 ShowCellGrid: Boolean; 50 51 procedure DrawArrow(Canvas: TCanvas; Pos: TPoint; Angle: Double; 51 52 Text: string; View: TView); … … 58 59 procedure DrawCellLinks(Canvas: TCanvas; View: TView); 59 60 procedure DrawNeighborLinks(Canvas: TCanvas; View: TView); 61 procedure DrawCities(Canvas: TCanvas; View: TView); 62 procedure DrawSelection(Canvas: TCanvas; View: TView); 60 63 procedure Paint(Canvas: TCanvas; View: TView); 61 64 constructor Create; override; … … 107 110 end; 108 111 with Canvas do begin 109 if Assigned(View.FocusedCell) and (View.FocusedCell = Cell) then begin 110 Pen.Color := clYellow; 111 Pen.Style := psSolid; 112 Pen.Width := 1; 113 end else 114 if Cell.MapCell.Terrain = ttCity then begin 115 // Cannot set clear border as it will display shifted on gtk2 116 //Pen.Style := psClear; 112 // Cannot set clear border as it will display shifted on gtk2 113 //Pen.Style := psClear; 114 Pen.Style := psSolid; 115 if ShowCellGrid then begin 117 116 Pen.Color := clBlack; 118 Pen.Style := psSolid; 119 Pen.Width := 3; 117 Pen.Width := Round(2 * View.Zoom); 120 118 end else begin 121 // Cannot set clear border as it will display shifted on gtk2122 //Pen.Style := psClear;123 119 Pen.Color := Brush.Color; 124 Pen.Style := psSolid;125 120 Pen.Width := 0; 126 121 end; 122 127 123 // Transform view 128 124 SetLength(Points, Length(Cell.MapCell.Polygon.Points)); … … 130 126 Points[I] := PointToStdPoint(View.CellToCanvasPos(Cell.MapCell.Polygon.Points[I])); 131 127 Brush.Style := bsSolid; 132 //Polygon(Points, False, 0, Length(Points));133 128 TCanvasEx.PolygonEx(Canvas, Points, False); 134 //MoveTo(Points[0].X, Points[0].Y);135 //LineTo(Points[1].X, Points[1].Y);136 129 137 130 // Show cell text … … 237 230 not ControlPlayer.PlayerMap.Cells.SearchCell(Move.CellTo.MapCell).InVisibleRange then 238 231 Continue; 239 if Move.CountRepeat > 0 then Pen.Width := 2240 else Pen.Width := 1;232 if Move.CountRepeat > 0 then Pen.Width := Round(2 * View.Zoom) 233 else Pen.Width := Round(1 * View.Zoom); 241 234 Angle := ArcTan2(PosTo.Y - PosFrom.Y, PosTo.X - PosFrom.X); 242 235 if (Angle > +Pi) or (Angle < -Pi) then … … 312 305 MapCell: TCell; 313 306 CellText: string; 307 Points: array of Classes.TPoint; 308 I: Integer; 314 309 begin 315 310 with Canvas, View do begin … … 404 399 end; 405 400 401 procedure TClientGUI.DrawCities(Canvas: TCanvas; View: TView); 402 var 403 Cell: TPlayerCell; 404 MapCell: TCell; 405 CellText: string; 406 Points: array of Classes.TPoint; 407 I: Integer; 408 begin 409 with Canvas, View do begin 410 if Assigned(ControlPlayer) then begin 411 for Cell in ControlPlayer.PlayerMap.Cells do begin 412 if (Cell.MapCell.Terrain <> ttVoid) and View.IsCellVisible(Cell.MapCell) then begin 413 if Cell.MapCell.Terrain = ttCity then begin 414 // Cannot set clear border as it will display shifted on gtk2 415 //Pen.Style := psClear; 416 Pen.Color := clBlack; 417 Pen.Style := psSolid; 418 Pen.Width := Round(6 * View.Zoom); 419 420 // Transform view 421 SetLength(Points, Length(Cell.MapCell.Polygon.Points) + 1); 422 for I := 0 to Length(Cell.MapCell.Polygon.Points) - 1 do 423 Points[I] := PointToStdPoint(View.CellToCanvasPos(Cell.MapCell.Polygon.Points[I])); 424 Points[Length(Points) - 1] := Points[0]; 425 TCanvasEx.PolyLineEx(Canvas, Points); 426 end; 427 end; 428 end; 429 end else begin 430 for MapCell in TGame(Game).Map.Cells do begin 431 if (MapCell.Terrain <> ttVoid) and View.IsCellVisible(MapCell) then begin 432 if View.IsCellVisible(MapCell) and (MapCell.Terrain <> ttVoid) then begin 433 if MapCell.Terrain = ttCity then begin 434 // Cannot set clear border as it will display shifted on gtk2 435 //Pen.Style := psClear; 436 Pen.Color := clBlack; 437 Pen.Style := psSolid; 438 Pen.Width := Round(6 * View.Zoom); 439 440 // Transform view 441 SetLength(Points, Length(MapCell.Polygon.Points) + 1); 442 for I := 0 to Length(MapCell.Polygon.Points) - 1 do 443 Points[I] := PointToStdPoint(View.CellToCanvasPos(MapCell.Polygon.Points[I])); 444 Points[Length(Points) - 1] := Points[0]; 445 TCanvasEx.PolyLineEx(Canvas, Points); 446 end; 447 end; 448 end; 449 end; 450 end; 451 end; 452 end; 453 454 procedure TClientGUI.DrawSelection(Canvas: TCanvas; View: TView); 455 var 456 Cell: TPlayerCell; 457 MapCell: TCell; 458 CellText: string; 459 Points: array of Classes.TPoint; 460 I: Integer; 461 begin 462 with Canvas, View do begin 463 if Assigned(ControlPlayer) then begin 464 if Assigned(View.FocusedCell) then begin 465 Pen.Color := clYellow; 466 Pen.Style := psSolid; 467 Pen.Width := Round(2 * View.Zoom); 468 469 // Transform view 470 SetLength(Points, Length(View.FocusedCell.MapCell.Polygon.Points) + 1); 471 for I := 0 to Length(View.FocusedCell.MapCell.Polygon.Points) - 1 do 472 Points[I] := PointToStdPoint(View.CellToCanvasPos(View.FocusedCell.MapCell.Polygon.Points[I])); 473 Points[Length(Points) - 1] := Points[0]; 474 TCanvasEx.PolyLineEx(Canvas, Points); 475 end; 476 end; 477 end; 478 end; 479 406 480 { TView } 407 481
Note:
See TracChangeset
for help on using the changeset viewer.