Get time that passed since the last frame? (Time.deltaTime?)

,

I just want to make sure I'm not missing something in the docs.

Coming from unity, there's a Time.deltaTime which is "The interval in seconds from the last frame to the current one". this is particularly useful to ensure frame rate fluctuations don't affect things that should actually be time based.

Is there an equivalent in the playdate sdk? should I just be calling playdate.getCurrentTimeMilliseconds() every frame and doing the math myself?

I use playdate.getElapsedTime() followed by playdate.resetElapsedTime()

Lua

local deltaTime = playdate.getElapsedTime()
playdate.resetElapsedTime()

C

float deltaTime = playdate->system->getElapsedTime();
playdate->system->resetElapsedTime();
3 Likes