Changeset 112 for trunk/Game.pas
- Timestamp:
- Dec 10, 2024, 4:18:33 PM (12 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Game.pas
r111 r112 125 125 DirectionText: array[TMoveDirection] of string = ('None', 'Left', 'Up', 'Right', 'Down'); 126 126 InitialTileCount = 2; 127 BoxFontSize = 20;127 BoxFontSize = 10; 128 128 129 129 resourcestring … … 599 599 ValueStr: string; 600 600 TextSize: TSize; 601 begin 601 CrossBorder: Integer; 602 FontHeightMultiplicator: Double; 603 begin 604 // TODO: Why the fonts set with Height have different size across platforms? 605 {$IFDEF UNIX} 606 FontHeightMultiplicator := 72 / 96; 607 {$ELSE} 608 FontHeightMultiplicator := 1; 609 {$ENDIF} 610 602 611 if Canvas.Brush.Style = bsClear then Exit; 603 612 604 613 Canvas.Pen.Style := psClear; 605 614 Canvas.RoundRect(TileRect, ScaleX(TileRect.Width div 20, 96), ScaleY(TileRect.Height div 20, 96)); 615 616 { if Tile.Unmergeable then begin 617 CrossBorder := ScaleX(Trunc(TileRect.Width / 50), 96); 618 Canvas.Pen.Width := ScaleX(Trunc(TileRect.Width / 30), 96); 619 Canvas.Pen.Style := psSolid; 620 Canvas.Pen.Color := Canvas.Font.Color; 621 Canvas.Line(TileRect.Left + CrossBorder, TileRect.Top + CrossBorder, 622 TileRect.Right - CrossBorder, TileRect.Bottom - CrossBorder); 623 Canvas.Line(TileRect.Right - CrossBorder, TileRect.Top + CrossBorder, 624 TileRect.Left + CrossBorder, TileRect.Bottom - CrossBorder); 625 end; 626 } 627 606 628 if WithText and (Tile.Value <> 0) then begin 607 629 if Tile.Disabled then ValueStr := '@' … … 609 631 else ValueStr := GetTileSkinValue(Tile.Value); 610 632 Canvas.Brush.Style := bsClear; 611 Canvas.Font.Height := Trunc(TileRect.Height * 0.7);633 Canvas.Font.Height := Trunc(TileRect.Height * FontHeightMultiplicator); 612 634 TextSize := Canvas.TextExtent(ValueStr); 613 635 if TextSize.Width > TileRect.Width then … … 642 664 with Canvas do begin 643 665 Font.Color := Core.Core.ThemeManager1.Theme.ColorControlText; 644 Font. Height:= Trunc(ScaleX(BoxFontSize, 96));666 Font.Size := Trunc(ScaleX(BoxFontSize, 96)); 645 667 646 668 BoxSize := Size(TextWidth(Title), TextHeight(Title) + TextHeight(Value)); … … 657 679 Brush.Style := bsClear; 658 680 Font.Color := Core.Core.ThemeManager1.Theme.ColorControlText; 659 Font. Height:= Trunc(ScaleX(BoxFontSize, 96));681 Font.Size := Trunc(ScaleX(BoxFontSize, 96)); 660 682 TextOut(Pos.X + (BoxSize.Width - TextWidth(Value)) div 2, 661 683 Pos.Y + TextHeight(Title), Value); … … 1015 1037 end; 1016 1038 1017 if RecordHistory then begin1039 if RecordHistory and Assigned(NewTile) then begin 1018 1040 HistoryMove := THistoryMove.Create; 1019 1041 HistoryMove.Direction := Direction;
Note:
See TracChangeset
for help on using the changeset viewer.