Changeset 448
- Timestamp:
- Nov 22, 2012, 2:45:14 PM (12 years ago)
- Location:
- GraphicTest
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GraphicTest/UDrawMethod.pas
r447 r448 7 7 uses 8 8 Classes, SysUtils, ExtCtrls, UPlatform, UFastBitmap, Graphics, Controls, 9 LCLType, IntfGraphics, fpImage, GraphType, 9 LCLType, IntfGraphics, fpImage, GraphType, DateUtils, 10 10 LclIntf{$IFDEF opengl}, GL, GLExt, OpenGLContext{$ENDIF}; 11 11 … … 19 19 private 20 20 FControl: TControl; 21 function GetFPS: Real; 21 22 public 22 23 Caption: string; … … 27 28 PaintObject: TPaintObject; 28 29 TempBitmap: TBitmap; 30 FrameCounter: Integer; 31 FrameCounterStart: TDateTime; 32 property FPS: Real read GetFPS; 29 33 procedure Init(Parent: TWinControl; Size: TPoint); virtual; 30 34 procedure Done; virtual; … … 173 177 { TDrawMethod } 174 178 179 function TDrawMethod.GetFPS: Real; 180 begin 181 Result := FrameCounter / ((NowPrecise - FrameCounterStart) / OneSecond); 182 FrameCounter := 0; 183 FrameCounterStart := NowPrecise; 184 end; 185 175 186 procedure TDrawMethod.Init(Parent: TWinControl; Size: TPoint); 176 187 begin -
GraphicTest/UMainForm.lfm
r447 r448 544 544 end 545 545 item 546 Caption = 'Step draw duration [ms]' 546 Caption = 'FPS' 547 end 548 item 549 Caption = 'Duration custom draw [ms]' 547 550 Width = 80 548 551 end 549 552 item 550 Caption = ' FPS'553 Caption = 'Draw FPS' 551 554 Width = 75 552 555 end 553 556 item 554 Caption = ' Total step duration[ms]'557 Caption = 'Duration step [ms]' 555 558 Width = 80 556 559 end -
GraphicTest/UMainForm.pas
r447 r448 130 130 StepStartTime := NowPrecise; 131 131 DrawFrameTiming(TFastBitmap(Scenes[SceneIndex])); 132 SceneIndex := (SceneIndex + 1) mod Scenes.Count;133 132 Application.ProcessMessages; 134 133 StepDuration := NowPrecise - StepStartTime; 134 SceneIndex := (SceneIndex + 1) mod Scenes.Count; 135 Inc(FrameCounter); 135 136 until TestTerminated or 136 137 ((TestTimeout > 0) and ((NowPrecise - StartTime) > OneSecond * TestTimeout)); … … 221 222 with TDrawMethod(DrawMethods[Item.Index]) do begin 222 223 Item.Caption := Caption; 224 Item.SubItems.Add(FloatToStr(RoundTo(FPS, -3))); 223 225 Item.SubItems.Add(FloatToStr(RoundTo(FrameDuration / OneMillisecond, -3))); 224 226 if FrameDuration > 0 then
Note:
See TracChangeset
for help on using the changeset viewer.