1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-17 01:32:21 +02:00

Fix fps indicator when xbrz is in use

This commit is contained in:
Ivan Savenko
2024-09-12 14:37:24 +00:00
parent dfd3f0c1a6
commit 6f6b20b716

View File

@ -181,17 +181,18 @@ Point CGuiHandler::screenDimensions() const
void CGuiHandler::drawFPSCounter()
{
int x = 7;
int y = screen->h-20;
int width3digitFPSIncludingPadding = 48;
int heightFPSTextIncludingPadding = 11;
int scaling = screenHandlerInstance->getScalingFactor();
int x = 7 * scaling;
int y = screen->h-20 * scaling;
int width3digitFPSIncludingPadding = 48 * scaling;
int heightFPSTextIncludingPadding = 11 * scaling;
SDL_Rect overlay = { x, y, width3digitFPSIncludingPadding, heightFPSTextIncludingPadding};
uint32_t black = SDL_MapRGB(screen->format, 10, 10, 10);
SDL_FillRect(screen, &overlay, black);
std::string fps = std::to_string(framerate().getFramerate())+" FPS";
graphics->fonts[FONT_SMALL]->renderTextLeft(screen, fps, Colors::WHITE, Point(8, screen->h-22));
graphics->fonts[FONT_SMALL]->renderTextLeft(screen, fps, Colors::WHITE, Point(8 * scaling, screen->h-22 * scaling));
}
bool CGuiHandler::amIGuiThread()