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 TCastleWindowCustom (see TCastleWindowCustom.FPS) or Lazarus GL control (see TCastleControlCustom.FPS).
Things named "_" here are supposed to be internal to the TCastleWindowCustom / TCastleControlCustom and such implementations. Other properties can be controlled by the user of TCastleWindowCustom / TCastleControlCustom.
Hierarchy
Overview
Methods
Properties
Description
Methods
 |
constructor Create; |
|
 |
procedure _RenderBegin; |
|
 |
procedure _RenderEnd; |
|
 |
procedure _UpdateBegin; |
|
Properties
 |
property FrameTime: Double read FFrameTime; |
Rendering speed in frames per second. This tells FPS, if we would only call Render (EventRender, OnRender) 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 EventRender (OnRender) calls per second. This means that it's actual speed of your program. Anything can slow this down, not only long EventRender (OnRender), 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 RenderSpeed that measured only EventRender (OnRender) speed).
You can sanely use this only within EventUpdate (OnUpdate).
|
 |
property MaxSensibleSecondsPassed: Single
read FMaxSensibleSecondsPassed write FMaxSensibleSecondsPassed; |
Limit the UpdateSecondsPassed variable, to avoid increasing time in game a lot when a game was hanging or otherwise waiting for some exceptional event from OS. Used only when non-zero.
|
 |
property UpdateStartTime: TTimerResult read FUpdateStartTime; |
Time of last Update call.
|
Generated by PasDoc 0.14.0.
|