Changeset 78 for trunk


Ignore:
Timestamp:
Nov 3, 2014, 8:04:02 PM (10 years ago)
Author:
chronos
Message:
  • Modified: Determine cell text size at once instead width and height separately.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r76 r78  
    162162begin
    163163  if RedrawPending then begin
    164     RedrawPending := False;
     164    if not Core.DevelMode then RedrawPending := False;
    165165    TimerPeriod := (9 * TimerPeriod + (Now - LastTimerTime)) / 10;
    166166    LastTimerTime := Now;
  • trunk/UGame.pas

    r77 r78  
    77uses
    88  Classes, SysUtils, ExtCtrls, Graphics, Contnrs, XMLConf, XMLRead, XMLWrite,
    9   DOM, Math, FileUtil, UXMLUtils, Dialogs;
     9  DOM, Math, FileUtil, UXMLUtils, Dialogs, Types;
    1010
    1111const
     
    929929  TextPos: TPoint;
    930930  Points: array of TPoint;
     931  TextSize: TSize;
    931932begin
    932933  with Canvas do begin
     
    957958    Pen.Style := psSolid;
    958959    Font.Color := clWhite;
     960    Brush.Style := bsClear;
    959961    Font.Size := Trunc(42 * View.Zoom);
    960962    TextPos := View.CellToCanvasPos(Pos);
    961     TextOut(Round(TextPos.X) - TextWidth(Text) div 2, Round(TextPos.Y) - TextHeight(Text) div 2, Text);
     963    TextSize := TextExtent(Text);
     964    TextOut(Round(TextPos.X) - TextSize.cx div 2, Round(TextPos.Y) - TextSize.cy div 2, Text);
    962965  end;
    963966end;
Note: See TracChangeset for help on using the changeset viewer.