1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Merge pull request #3182 from Alexander-Wilms/fix-fps-counter

Move FPS counter to bottom left, set width of black background to suf…
This commit is contained in:
Ivan Savenko 2023-11-15 13:56:27 +02:00 committed by GitHub
commit 060e1cef21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -183,11 +183,17 @@ Point CGuiHandler::screenDimensions() const
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);
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()