Changeset 112 for trunk/Game.pas


Ignore:
Timestamp:
Dec 10, 2024, 4:18:33 PM (12 days ago)
Author:
chronos
Message:
  • Fixed: Scaling of tiles text.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Game.pas

    r111 r112  
    125125  DirectionText: array[TMoveDirection] of string = ('None', 'Left', 'Up', 'Right', 'Down');
    126126  InitialTileCount = 2;
    127   BoxFontSize = 20;
     127  BoxFontSize = 10;
    128128
    129129resourcestring
     
    599599  ValueStr: string;
    600600  TextSize: TSize;
    601 begin
     601  CrossBorder: Integer;
     602  FontHeightMultiplicator: Double;
     603begin
     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
    602611  if Canvas.Brush.Style = bsClear then Exit;
    603612
    604613  Canvas.Pen.Style := psClear;
    605614  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
    606628  if WithText and (Tile.Value <> 0) then begin
    607629    if Tile.Disabled then ValueStr := '@'
     
    609631      else ValueStr := GetTileSkinValue(Tile.Value);
    610632    Canvas.Brush.Style := bsClear;
    611     Canvas.Font.Height := Trunc(TileRect.Height * 0.7);
     633    Canvas.Font.Height := Trunc(TileRect.Height * FontHeightMultiplicator);
    612634    TextSize := Canvas.TextExtent(ValueStr);
    613635    if TextSize.Width > TileRect.Width then
     
    642664  with Canvas do begin
    643665    Font.Color := Core.Core.ThemeManager1.Theme.ColorControlText;
    644     Font.Height := Trunc(ScaleX(BoxFontSize, 96));
     666    Font.Size := Trunc(ScaleX(BoxFontSize, 96));
    645667
    646668    BoxSize := Size(TextWidth(Title), TextHeight(Title) + TextHeight(Value));
     
    657679    Brush.Style := bsClear;
    658680    Font.Color := Core.Core.ThemeManager1.Theme.ColorControlText;
    659     Font.Height := Trunc(ScaleX(BoxFontSize, 96));
     681    Font.Size := Trunc(ScaleX(BoxFontSize, 96));
    660682    TextOut(Pos.X + (BoxSize.Width - TextWidth(Value)) div 2,
    661683      Pos.Y + TextHeight(Title), Value);
     
    10151037    end;
    10161038
    1017     if RecordHistory then begin
     1039    if RecordHistory and Assigned(NewTile) then begin
    10181040      HistoryMove := THistoryMove.Create;
    10191041      HistoryMove.Direction := Direction;
Note: See TracChangeset for help on using the changeset viewer.