1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Move FPS counter to bottom left, set width of black background to suffice for 3 digit FPS

Fixes #3171
This commit is contained in:
Alexander Wilms 2023-11-13 00:04:42 +01:00
parent b86060d729
commit c0c16fed75

View File

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