Get rid of the FPS counter.

The counter was added solely as a debug feature in commit e7c8c1c8,
which introduced the new Canvas system. It doesn't work all that well
and brings little value, so let's get rid of the visual noise.
This commit is contained in:
whitequark 2020-05-29 17:45:09 +00:00
parent 89e6559e2d
commit 225f82a292

View File

@ -841,17 +841,15 @@ void GraphicsWindow::Paint() {
ForceTextWindowShown(); ForceTextWindowShown();
} }
auto renderStartTime = std::chrono::high_resolution_clock::now();
canvas->SetLighting(lighting); canvas->SetLighting(lighting);
canvas->SetCamera(camera); canvas->SetCamera(camera);
canvas->StartFrame(); canvas->StartFrame();
// Draw the 3d objects.
Draw(canvas.get()); Draw(canvas.get());
canvas->FlushFrame(); canvas->FlushFrame();
auto renderEndTime = std::chrono::high_resolution_clock::now(); // Draw the 2d UI overlay.
std::chrono::duration<double, std::milli> renderTime = renderEndTime - renderStartTime;
camera.LoadIdentity(); camera.LoadIdentity();
camera.offset.x = -(double)camera.width / 2.0; camera.offset.x = -(double)camera.width / 2.0;
camera.offset.y = -(double)camera.height / 2.0; camera.offset.y = -(double)camera.height / 2.0;
@ -888,19 +886,6 @@ void GraphicsWindow::Paint() {
ToolbarDraw(&uiCanvas); ToolbarDraw(&uiCanvas);
} }
// Also display an fps counter.
RgbaColor renderTimeColor;
if(renderTime.count() > 16.67) {
// We aim for a steady 60fps; draw the counter in red when we're slower.
renderTimeColor = { 255, 0, 0, 255 };
} else {
renderTimeColor = { 255, 255, 255, 255 };
}
uiCanvas.DrawBitmapText(ssprintf("rendered in %ld ms (%ld 1/s)",
(long)renderTime.count(),
(long)(1000 / std::max(0.1, renderTime.count()))),
5, 5, renderTimeColor);
canvas->FlushFrame(); canvas->FlushFrame();
canvas->FinishFrame(); canvas->FinishFrame();
canvas->Clear(); canvas->Clear();