We should make it easy to add an FPS counter / track FPS - on both the native and JSOO side.
Related to #230 , in the sense of having a performance metric be front-and-center (FPS counter gives a view of overall performance, while a tracking square can help identify stutter/jitter).
Thanks @sgrove for the suggestion!
A couple of things we'll have to consider:
<FPSCounter /> in user-space?FPS: -? Alternatively, we could show a metric like 'lastRenderTime' which is the time in ms spent to render the last frame.I decided to work on this and my progress is on my add-fps-counter branch.
Keeping track of fps is simple, I just needed to add a counter to the window type in Core/Window that stores the tick (from SDL's getTick) after each render cycle, and the time it took to render the last frame, using that.
Then I gave the Window module two new functions: getFPS, which returns the FPS as a float, and getLastRenderTime, which returns the last render time in milliseconds as an int.
I'm gonna see about adding an <FPSCounter /> and then make a PR with my changes.
Since my PR was merged this issue can be closed. Sorry I forgot in to write "resolves #..." in the message.
Thanks for the PR @Grinshpon!