cerlib internally maintains a set of frame-related properties such as tick rate and the number of draw calls performed.
You can use these to aid debugging or to analyze performance-related issues.
Simply call the cer::frameStats()
function, which will provide you with a cer::FrameStats
object.
/**
* Represents drawing statistics of a frame.
*/
struct FrameStats {
/** The number of ticks processed in the last second. */
double tickRate = 0.0;
/** The number of draw calls that were performed in total. */
int drawCalls = 0;
};
Example:
while (game.tick()) {
// ...
auto stats = frameStats();
auto text = format("{} Draw calls, {} FPS", stats.drawCalls, stats.tickRate);
drawString(text.view(), Font::builtIn(), 32, {100, 100});
}