Closed Dan-Crane closed 1 year ago
engine.durationPerUpdate
has a stream that I can subscribe to and listen to the changes.
engine.durationPerUpdate.stream.listen((event) {
time.updateDt(event.inMicroseconds / Duration.microsecondsPerSecond);
});
You can use the msUpdate value, but that's a good point, I will integrate it into the update function itself as a paremeter
durationPerUpdate is what what it aims for and msUpdate is the actual duration since the last frame.
That would be cool:)
I would like to have delta time in both onUpdate and onRender
I added it to the onUpdate function (see 0.5.1)
the delta is a double which represents the goal_duration / actual_duration so any physics equations can use that decimal to maintain consistence
the renderFunction is a little trickier because it can depend on the settings, if the drawCanvasAfterUpdate flag is true it will render after that, otherwise it might be rendered manually,
In any case you can still get the duration since the last render with the msRender variable.
Can you please tell me how do I get the time difference from the past frame?