From 066f444dd04b3a457e55ba03904b47ec1efd9486 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 3 Jan 2020 06:28:25 +0100 Subject: [PATCH] Hook up vid_fps --- source/common/rendering/gl/system/gl_framebuffer.cpp | 1 + source/common/rendering/v_framebuffer.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/source/common/rendering/gl/system/gl_framebuffer.cpp b/source/common/rendering/gl/system/gl_framebuffer.cpp index 848e49996..bdfe0ca91 100644 --- a/source/common/rendering/gl/system/gl_framebuffer.cpp +++ b/source/common/rendering/gl/system/gl_framebuffer.cpp @@ -408,6 +408,7 @@ void OpenGLFrameBuffer::Draw2D() { GLRenderer->mBuffers->BindCurrentFB(); ::DrawFullscreenBlends(); + DrawRateStuff(); GLInterface.Draw2D(&twodgen); } } diff --git a/source/common/rendering/v_framebuffer.cpp b/source/common/rendering/v_framebuffer.cpp index 425ba93fc..0782ae49e 100644 --- a/source/common/rendering/v_framebuffer.cpp +++ b/source/common/rendering/v_framebuffer.cpp @@ -126,6 +126,17 @@ void DFrameBuffer::DrawRateStuff () // Draws frame time and cumulative fps if (vid_fps) { + FString fpsbuff = gi->statFPS(); + + int textScale = active_con_scale(); + int rate_x = Width / textScale - NewConsoleFont->StringWidth(&fpsbuff[0]); + twod->AddColorOnlyQuad(rate_x * textScale, 0, Width, NewConsoleFont->GetHeight() * textScale, MAKEARGB(255,0,0,0)); + DrawText (twod, NewConsoleFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0], + DTA_VirtualWidth, screen->GetWidth() / textScale, + DTA_VirtualHeight, screen->GetHeight() / textScale, + DTA_KeepRatio, true, TAG_DONE); + + #if 0 uint64_t ms = screen->FrameTime; uint64_t howlong = ms - LastMS; if ((signed)howlong >= 0) @@ -154,6 +165,7 @@ void DFrameBuffer::DrawRateStuff () FrameCount++; } LastMS = ms; + #endif } }