1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Moved fonts handling from Graphics to RenderHandler class

This commit is contained in:
Ivan Savenko
2024-09-23 15:43:11 +00:00
parent 92c5fd4156
commit 248cff49a4
21 changed files with 132 additions and 101 deletions

View File

@@ -256,15 +256,17 @@ void InfoCard::changeSelection()
if(!showChat)
labelGroupPlayers->disable();
const auto & font = GH.renderHandler().loadFont(FONT_SMALL);
for(const auto & p : CSH->playerNames)
{
int slotsUsed = labelGroupPlayers->currentSize();
Point labelPosition;
if(slotsUsed < 4)
labelPosition = Point(24, 285 + slotsUsed * graphics->fonts[FONT_SMALL]->getLineHeight()); // left column
labelPosition = Point(24, 285 + slotsUsed * font->getLineHeight()); // left column
else
labelPosition = Point(193, 285 + (slotsUsed - 4) * graphics->fonts[FONT_SMALL]->getLineHeight()); // right column
labelPosition = Point(193, 285 + (slotsUsed - 4) * font->getLineHeight()); // right column
labelGroupPlayers->add(labelPosition.x, labelPosition.y, p.second.name);
}
@@ -358,7 +360,8 @@ CChatBox::CChatBox(const Rect & rect)
pos += rect.topLeft();
setRedrawParent(true);
const int height = static_cast<int>(graphics->fonts[FONT_SMALL]->getLineHeight());
const auto & font = GH.renderHandler().loadFont(FONT_SMALL);
const int height = font->getLineHeight();
Rect textInputArea(1, rect.h - height, rect.w - 1, height);
Rect chatHistoryArea(3, 1, rect.w - 3, rect.h - height - 1);
inputBackground = std::make_shared<TransparentFilledRectangle>(textInputArea, ColorRGBA(0,0,0,192));