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
Fields
Methods
Properties
Description
Fields
 |
internal const DefaultMaxSensibleSecondsPassed = 0.5; |
|
Methods
 |
constructor Create; |
|
Properties
 |
property FrameTime: TFloatTime read FOnlyRenderFps; deprecated 'use OnlyRenderFps'; |
Warning: this symbol is deprecated: use OnlyRenderFps |
 |
property RealFps: TFloatTime read FRealFps; |
How many frames per second were actually rendered. This is the number of TUIContainer.EventRender calls that actually happened within a real second of time. So it's an actual speed of your program. Anything can slow this down, not only long rendering, but also slow processing of other events (like "update" that does physics).
When TCastleWindowCustom.AutoRedisplay or TCastleControlCustom.AutoRedisplay is False , this may be very low, since we may not render the frames all the time (we may sleep for some time, or perform updates without rendering). In this case, the RealFps value may be confusing and useless (it does not reflect the speed of your application). Use the WasSleeping to detect this, and potentially hide the display of RealFps from user.
See https://castle-engine.sourceforge.io/manual_optimization.php#section_fps for a detailed description what FPS mean and how they should be interpreted.
See also
- OnlyRenderFps
- Rendering speed, measured in frames per second, but accounting only time spent inside "render" calls (thus ignoring time spent on physics and other logic).
|
 |
property RealTime: TFloatTime read FRealFps; deprecated 'use RealFps'; |
Warning: this symbol is deprecated: use RealFps |
 |
property SecondsPassed: TFloatTime read FSecondsPassed; |
How much time passed since the last "update". You should use this inside "update" events and methods (TUIContainer.EventUpdate, TInputListener.Update, TCastleTransform.Update...) to scale the movement. This way, your animation will work with the same speed (objects will travel at the same speed), regardless of the system performance (regardless of how often the "update" event occurs).
This is calculated as a time between start of previous "update" event and start of current "update" event.
|
 |
property UpdateSecondsPassed: TFloatTime read FSecondsPassed; deprecated 'use SecondsPassed'; |
Warning: this symbol is deprecated: use SecondsPassed |
 |
property MaxSensibleSecondsPassed: TFloatTime
read FMaxSensibleSecondsPassed write FMaxSensibleSecondsPassed; |
Limit the SecondsPassed 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. By default it's DefaultMaxSensibleSecondsPassed.
|
 |
property UpdateStartTime: TTimerResult read FUpdateStartTime; |
Time of last Update call.
|
Generated by PasDoc 0.15.0.
|