Castle Game EngineIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers |
Class TFramesPerSecond
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
Overview
Methods
Properties
Description
Methods
 |
constructor Create; |
|
 |
procedure _RenderBegin; |
|
 |
procedure _RenderEnd; |
|
 |
procedure _IdleBegin; |
|
 |
procedure IgnoreNextIdleSpeed; |
Forces IdleSpeed within the next EventIdle (onIdle) call to be equal to 0.0.
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). IdleSpeed 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 IdleSpeed is 0.0, so things such as TCastleSceneCore.Time should not advance wildly just because we did GUI box.
This forces the IdleSpeed to zero only once, that is only on the next EventIdle (OnIdle). Following EventIdle (OnIdle) will have IdleSpeed as usual (unless you call IgnoreNextIdleSpeed 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 OnIdle, 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 OnIdle). 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 IdleSpeed: Single read FIdleSpeed; |
How much time passed since last EventIdle (OnIdle) call?
The time is in seconds, 1.0 = 1 second. For two times faster computer IdleSpeed = 0.5, for two times slower IdleSpeed = 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 Idle event and start of current Idle 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 EventIdle (OnIdle).
|
 |
property IdleStartTime: TTimerResult read FIdleStartTime; |
Time of last idle call.
|
Generated by PasDoc 0.12.1 on 2013-02-04 20:26:52
|