Skip to content

fps_counter

Anthony Samms edited this page Jun 2, 2026 · 1 revision

FPSCounter measures and displays the current frame rate. It averages the last 60 frame times to smooth the reading and color-codes the display based on performance.

FPSCounter

FPSCounter();

Initialises the rolling average buffer to 60 fps (16.67 ms per frame).

Update and Draw

void update();

Records the current frame's delta time into the rolling buffer.

float get_fps();

Returns the average FPS over the last 60 frames.

void draw();

Draws the FPS value in the top-left corner scaled by global_tex.screen_scale. The text color is red below 30 fps, yellow below 60 fps, and green at 60 fps or above.

Clone this wiki locally