Changeset 100 for trunk/Game.pas


Ignore:
Timestamp:
Dec 9, 2024, 9:41:19 AM (13 days ago)
Author:
chronos
Message:
  • Fixed: Board size calculation inside the main window.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Game.pas

    r90 r100  
    651651  S: TPoint;
    652652  MetaCanvas: TMetaCanvas;
     653  BorderSize: Integer;
    653654begin
    654655  MetaCanvas := TMetaCanvas.Create;
     
    673674  // Form.Canvas.Width and Form.Canvas.Height is not working correctly under Windows.
    674675  // So dimensions are provided by CanvasSize parameter.
    675   Frame := Rect(2, TopBarHeight, CanvasSize.X - 2, CanvasSize.Y - 2);
     676  BorderSize := ScaleY(2, 96);
     677  Frame := Rect(BorderSize, BorderSize + TopBarHeight, CanvasSize.X - BorderSize, CanvasSize.Y - BorderSize);
    676678  TileSize := Point(Frame.Width div Board.Size.X, Frame.Height div Board.Size.Y);
    677679  if TileSize.X < TileSize.Y then TileSize.Y := TileSize.X;
    678680  if TileSize.Y < TileSize.X then TileSize.X := TileSize.Y;
    679   Frame := Rect(Frame.Width div 2 - (Board.Size.X * TileSize.X) div 2,
     681  Frame := Rect(Frame.Left + Frame.Width div 2 - (Board.Size.X * TileSize.X) div 2,
    680682    Frame.Top + Frame.Height div 2 - (Board.Size.Y * TileSize.Y) div 2,
    681     Frame.Width div 2 + (Board.Size.X * TileSize.X) div 2,
     683    Frame.Left + Frame.Width div 2 + (Board.Size.X * TileSize.X) div 2,
    682684    Frame.Top + Frame.Height div 2 + (Board.Size.Y * TileSize.Y) div 2);
    683685
Note: See TracChangeset for help on using the changeset viewer.