feat: more precise stats

This commit is contained in:
2025-11-10 16:01:25 +01:00
parent 009b19e404
commit e85b744488

View File

@@ -4,7 +4,7 @@ const props = withDefaults(defineProps<{ x?: number; y?: number }>(), {
y: 0,
});
const SAMPLES = 60;
const SAMPLES = 600;
let average = { deltaTime: 0, realDeltaTime: 0 };
const lastFrames: (typeof average)[] = [];
@@ -36,7 +36,7 @@ useRender((ctx) => {
let textY = props.y;
ctx.fillStyle = "black";
ctx.fillText("[avg on 60 frames]", props.x, (textY += LINE_HEIGHT));
ctx.fillText(`[avg on ${SAMPLES} frames]`, props.x, (textY += LINE_HEIGHT));
ctx.fillText(
`fps=${(1000 / average.deltaTime).toFixed()}`,
props.x,