Can anyone tell me where to find the functions for base playdate functions? I want to know how the playdate finds the FPS so I want to find the code for playdate.drawFPS. I looked in the CoreLibs folder but didn't find it. I am on windows using SDK v1.12.0
Parts of CoreLibs are implemented in C for performance reasons; the Lua code we provide calls into a compiled library that resides in firmware. You won’t find the source code for those functions in the SDK. (Playdate is an open platform but it’s not open-source.)
The drawFPS()
function is most likely in this category not because it’s some big trade secret, but just for maximum efficiency. We don’t want to lower the frame rate as a side effect of displaying it.
Where can I view this function? I want to see how it’s done so I can get the FPS. I have a function for estimating it, but it always seems to be a bit off.
So you want a playdate.getFPS() function?
You might consider using playdate.getCurrentTimeMilliseconds()
each frame and averaging the time spent between the previous however many frames to approximate the frame rate. I imagine drawFPS()
is doing something similar.
I already do this, I was just wondering how they did it so it would be exactly similar
yes please, that would be very useful!
I've changed this topic into a Feature Request
Filed a feature request for playdate.getFPS()
. Thanks for the suggestion!