Ignore:
Timestamp:
Nov 23, 2012, 2:09:49 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Real FPS is now measured as cumulative.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/UDrawMethod.pas

    r449 r451  
    3030    FrameCounter: Integer;
    3131    FrameCounterStart: TDateTime;
     32    FrameCounterStop: TDateTime;
    3233    function GetFPS: Real;
    3334    property FPS: Real read FFPS write FFPS;
     
    180181
    181182function TDrawMethod.GetFPS: Real;
    182 begin
    183   Result := FrameCounter / ((NowPrecise - FrameCounterStart) / OneSecond);
    184   FrameCounter := 0;
    185   FrameCounterStart := NowPrecise;
     183var
     184  StopTime: TDateTime;
     185begin
     186  if FrameCounterStop <> 0 then StopTime := FrameCounterStop
     187    else StopTime := NowPrecise;
     188  if FrameCounter > 0 then begin
     189    Result := FrameCounter / ((StopTime - FrameCounterStart) / OneSecond);
     190    //FrameCounter := 0;
     191    //FrameCounterStart := NowPrecise;
     192  end else Result := FFPS;
    186193end;
    187194
Note: See TracChangeset for help on using the changeset viewer.