Changeset 73


Ignore:
Timestamp:
Oct 4, 2014, 9:05:59 PM (10 years ago)
Author:
chronos
Message:
  • Modified: Show draw time in ms smoothed.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r71 r73  
    11object FormMain: TFormMain
    2   Left = 278
     2  Left = 490
    33  Height = 621
    4   Top = 84
     4  Top = 358
    55  Width = 775
    66  Caption = 'xTactics'
    7   ClientHeight = 595
     7  ClientHeight = 592
    88  ClientWidth = 775
    99  Menu = MainMenu1
     
    1515  LCLVersion = '1.3'
    1616  WindowState = wsMaximized
    17   object PaintBox1: TPaintBox
    18     Left = 40
    19     Height = 569
    20     Top = 0
    21     Width = 735
    22     Align = alClient
    23     ParentColor = False
    24     OnMouseDown = PaintBox1MouseDown
    25     OnMouseMove = PaintBox1MouseMove
    26     OnMouseUp = PaintBox1MouseUp
    27     OnMouseLeave = PaintBox1MouseLeave
    28     OnMouseWheelDown = PaintBox1MouseWheelDown
    29     OnMouseWheelUp = PaintBox1MouseWheelUp
    30     OnPaint = PaintBox1Paint
    31     OnResize = PaintBox1Resize
    32   end
    3317  object StatusBar1: TStatusBar
    3418    Left = 0
    35     Height = 26
    36     Top = 569
     19    Height = 29
     20    Top = 563
    3721    Width = 775
    3822    Panels = <   
    3923      item
    40         Width = 100
     24        Width = 200
    4125      end   
    4226      item
    43         Width = 100
     27        Width = 150
    4428      end   
    4529      item
     
    5034  object ToolBar1: TToolBar
    5135    Left = 0
    52     Height = 569
     36    Height = 563
    5337    Top = 0
    5438    Width = 40
     
    10993    end
    11094  end
     95  object PaintBox1: TPaintBox
     96    Left = 40
     97    Height = 563
     98    Top = 0
     99    Width = 735
     100    Align = alClient
     101    OnMouseDown = PaintBox1MouseDown
     102    OnMouseMove = PaintBox1MouseMove
     103    OnMouseUp = PaintBox1MouseUp
     104    OnMouseLeave = PaintBox1MouseLeave
     105    OnMouseWheelDown = PaintBox1MouseWheelDown
     106    OnMouseWheelUp = PaintBox1MouseWheelUp
     107    OnPaint = PaintBox1Paint
     108    OnResize = PaintBox1Resize
     109  end
    111110  object MainMenu1: TMainMenu
    112111    Images = Core.ImageListSmall
     
    178177  end
    179178  object Timer1: TTimer
    180     Interval = 20
     179    Interval = 10
    181180    OnTimer = Timer1Timer
    182181    left = 154
  • trunk/Forms/UFormMain.pas

    r72 r73  
    9595    RedrawPending: Boolean;
    9696    DrawDuration: TDateTime;
     97    LastTimerTime: TDateTime;
     98    TimerPeriod: TDateTime;
    9799  public
    98100    procedure LoadConfig(Config: TXmlConfig; Path: string);
     
    122124begin
    123125  DrawStart := Now;
    124   //if Core.Game.Running then
    125126  if Assigned(Core.Game.CurrentPlayer) then
    126127  with Core.Game.CurrentPlayer do begin
     
    132133      Paint(TempBitmap.Canvas);
    133134      PaintBox1.Canvas.Draw(0, 0, TempBitmap);
    134     end else Paint(PaintBox1.Canvas);
    135   end;
    136   DrawDuration := Now - DrawStart;
     135    end else begin
     136      Paint(PaintBox1.Canvas);
     137    end;
     138  end;
     139  DrawDuration := (9 * DrawDuration + (Now - DrawStart)) / 10;
    137140end;
    138141
     
    153156var
    154157  NewCaption: string;
    155   DrawStart: TDateTime;
    156158begin
    157159  if RedrawPending then begin
    158160    RedrawPending := False;
     161    TimerPeriod := (9 * TimerPeriod + (Now - LastTimerTime)) / 10;
     162    LastTimerTime := Now;
    159163    PaintBox1.Repaint;
    160     StatusBar1.Panels[1].Text := IntToStr(Trunc(DrawDuration / OneMillisecond)) + ' ms';
     164    StatusBar1.Panels[1].Text := IntToStr(Trunc(DrawDuration / OneMillisecond)) + ' / ' +
     165      IntToStr(Trunc(TimerPeriod / OneMillisecond)) + ' ms';
    161166    NewCaption := 'xTactics';
    162167    if Assigned(Core.Game.CurrentPlayer) then
     
    213218  //DoubleBuffered := True;
    214219  TempBitmap := TBitmap.Create;
     220  TimerPeriod := 0;
     221  LastTimerTime := Now;
    215222end;
    216223
  • trunk/xtactics.lpi

    r70 r73  
    111111        <HasResources Value="True"/>
    112112        <ResourceBaseClass Value="Form"/>
     113        <UnitName Value="UFormPlayer"/>
    113114      </Unit3>
    114115      <Unit4>
     
    134135        <HasResources Value="True"/>
    135136        <ResourceBaseClass Value="Form"/>
    136         <UnitName Value="UFormMove"/>
    137137      </Unit6>
    138138      <Unit7>
Note: See TracChangeset for help on using the changeset viewer.