The Timer class acts as a global time measurement that can be accessed from various parts of the engine. These three values are representation of the same underlying calculus: tmod, dt, fps
staticdt:Float = 1 / wantedFPS
The smoothed elapsed time (in seconds).
staticread onlyelapsedTime:Float = 0.
The amount of time (unsmoothed) that was spent since the last frame.
staticframeCount:Int = 0
A frame counter, increases on each call to update()
staticread onlylastTimeStamp:Float = haxe.Timer.stamp()
The last timestamp in which update() function was called.
staticmaxDeltaTime:Float = 0.5
The maximum amount of time between two frames (in seconds). If the time exceed this amount, Timer will consider these lags are to be ignored. Default : 0.5
staticsmoothFactor:Float = 0.95
The smoothing done between frames. A smoothing of 0 gives "real time" values, higher values will smooth the results for tmod/dt/fps over frames using the formula dt = lerp(dt, elapsedTime, smoothFactor) Default : 0 on HashLink, 0.95 on other platforms
The smoothed frame modifier, based on wantedFPS. Its value is the same as dt/wantedFPS Allows to express movements in terms of pixels-per-frame-at-wantedFPS instead of per second.
staticwantedFPS:Float = 60.
The FPS on which "tmod" have values are based on. Can be freely configured if your gameplay runs at a different speed. Default : 60
The current smoothed FPS.
Similar as skip() but also reset dt to default value. Can be used when starting a new game if you want to discard any previous measurement.
After some loading / long processing, call skip() in order to prevent it from impacting your smoothed values.
Update the timer calculus on each frame. This is automatically called by hxd.App