()
| 503 | |
| 504 | function startStatsLoop() { |
| 505 | function updateLoop() { |
| 506 | frameCount++; |
| 507 | const now = performance.now(); |
| 508 | |
| 509 | // FPS calculation (every 500ms) |
| 510 | if (now - lastFpsTime >= 500) { |
| 511 | fps = Math.round(frameCount / ((now - lastFpsTime) / 1000)); |
| 512 | frameCount = 0; |
| 513 | lastFpsTime = now; |
| 514 | } |
| 515 | |
| 516 | // Ticks/sec calculation |
| 517 | if (now - lastTickTime >= 1000) { |
| 518 | const currentTicks = tickSimulator.getTickCount(); |
| 519 | ticksPerSec = currentTicks - lastTickCount; |
| 520 | lastTickCount = currentTicks; |
| 521 | lastTickTime = now; |
| 522 | } |
| 523 | |
| 524 | updateStats(); |
| 525 | requestAnimationFrame(updateLoop); |
| 526 | } |
| 527 | requestAnimationFrame(updateLoop); |
| 528 | } |
| 529 |
nothing calls this directly
no test coverage detected