Castle Game Engine: CastleTimeUtils: Class TFramesPerSecond

# Class TFramesPerSecond
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleTimeUtils ## Declaration `type TFramesPerSecond = class(TObject)` ## Description Utility to measure frames per second, independent of actual rendering API. For example, it can be easily "plugged" into TCastleWindowBase (see TCastleWindowBase.FPS) or Lazarus GL control (see TCastleControlCustom.FPS). Things named "_" here are supposed to be internal to the TCastleWindowBase / TCastleControlCustom and such implementations. Other properties can be controlled by the user of TCastleWindowBase / TCastleControlCustom. ## Hierarchy TObject TFramesPerSecond ## Overview ### Methods
| `constructor Create;`
| `procedure _RenderBegin;`
| `procedure _RenderEnd;`
| `procedure _UpdateBegin;`
| `procedure ZeroNextSecondsPassed;`
### Properties
| `property FrameTime: Double read FFrameTime;`
| `property RealTime: Double read FRealTime;`
| `property UpdateSecondsPassed: Single read FUpdateSecondsPassed;`
| `property UpdateStartTime: TTimerResult read FUpdateStartTime;`
## Description ### Methods
| `constructor Create;`
| `procedure _RenderBegin;`
| `procedure _RenderEnd;`
| `procedure _UpdateBegin;`
| `procedure ZeroNextSecondsPassed;`
Forces UpdateSecondsPassed for the next Update call (using _UpdateBegin) to be zero. This is useful if you just came back from some lenghty state, like a GUI dialog box (like TCastleWindowBase.FileDialog or modal boxes in CastleMessages — but actually all our stuff already calls this as needed, TGLMode takes care of this). UpdateSecondsPassed would be ridicoulously long in such case (if our loop is totally stopped) or not relevant (if we do our loop, but with totally different callbacks, like CastleMessages). Instead, it's most sensible in such case to fake that UpdateSecondsPassed is 0.0, so things such as TCastleSceneCore.Time should not advance wildly just because we did GUI box. This forces the UpdateSecondsPassed to zero only once, that is only on the next update event (_UpdateBegin). Following update event (_UpdateBegin) will have UpdateSecondsPassed as usual (unless you call `ZeroNextSecondsPassed` again, of course).
### Properties
| `property FrameTime: Double read FFrameTime;`
Rendering speed in frames per second. This tells FPS, if we would only call Draw (EventDraw, OnDraw) all the time. That is, this doesn't take into account time spent on other activities, like OnUpdate, and it doesn't take into account that frames are possibly not rendered continously (when AutoRedisplay = `False`, we may render frames seldom, because there's no need to do it more often). ###### See also RealTime How many frames per second were rendered.
| `property RealTime: Double read FRealTime;`
How many frames per second were rendered. This is a real number of EventDraw (OnDraw) calls per second. This means that it's actual speed of your program. Anything can slow this down, not only long EventDraw (OnDraw), but also slow processing of other events (like OnUpdate). Also, when AutoRedisplay = `False`, this may be very low, since you just don't need to render frames continously. ###### See also FrameTime Rendering speed in frames per second.
| `property UpdateSecondsPassed: Single read FUpdateSecondsPassed;`
Track how much time passed since last Update call, using _UpdateBegin. The time is in seconds, 1.0 = 1 second. For two times faster computer `UpdateSecondsPassed` = 0.5, for two times slower `UpdateSecondsPassed` = 2.0. This is useful for doing time-based rendering, when you want to scale some changes by computer speed, to get perceived animation speed the same on every computer, regardless of computer's speed. This is calculated as a time between start of previous Update event and start of current Update event. So this really measures your whole loop time (unlike previous DrawSpeed that measured only EventDraw (OnDraw) speed). You can sanely use this only within EventUpdate (OnUpdate).
| `property UpdateStartTime: TTimerResult read FUpdateStartTime;`
Time of last Update call.
Generated by PasDoc 0.13.0 on 2013-08-17 21:27:14