Improved font sizing for the launch screen, scraper and help system.

This commit is contained in:
Leon Styhre 2022-10-25 01:06:02 +02:00
parent ddf5684a9e
commit 97a9347d67
3 changed files with 11 additions and 12 deletions

View file

@ -55,8 +55,8 @@ void GuiLaunchScreen::displayLaunchScreen(FileData* game)
// Title.
mTitle = std::make_shared<TextComponent>(
"LAUNCHING GAME",
Font::get(static_cast<int>(
titleFontSize * std::min(Renderer::getScreenHeight(), Renderer::getScreenWidth()))),
Font::get(titleFontSize *
std::min(Renderer::getScreenHeight(), Renderer::getScreenWidth())),
0x666666FF, ALIGN_CENTER);
mGrid->setEntry(mTitle, glm::ivec2 {1, 1}, false, true, glm::ivec2 {1, 1});
@ -75,8 +75,8 @@ void GuiLaunchScreen::displayLaunchScreen(FileData* game)
// Game name.
mGameName = std::make_shared<TextComponent>(
"GAME NAME",
Font::get(static_cast<int>(
gameNameFontSize * std::min(Renderer::getScreenHeight(), Renderer::getScreenWidth()))),
Font::get(gameNameFontSize *
std::min(Renderer::getScreenHeight(), Renderer::getScreenWidth())),
0x444444FF, ALIGN_CENTER);
mGrid->setEntry(mGameName, glm::ivec2 {1, 5}, false, true, glm::ivec2 {1, 1});
@ -108,11 +108,10 @@ void GuiLaunchScreen::displayLaunchScreen(FileData* game)
float maxWidth {Renderer::getScreenWidth() * maxWidthModifier};
float minWidth {Renderer::getScreenWidth() * minWidthModifier};
float fontWidth {
Font::get(static_cast<int>(gameNameFontSize * std::min(Renderer::getScreenHeight(),
Renderer::getScreenWidth())))
->sizeText(Utils::String::toUpper(game->getName()))
.x};
float fontWidth {Font::get(gameNameFontSize *
std::min(Renderer::getScreenHeight(), Renderer::getScreenWidth()))
->sizeText(Utils::String::toUpper(game->getName()))
.x};
// Add a bit of width to compensate for the left and right spacers.
fontWidth += Renderer::getScreenWidth() * 0.05f;

View file

@ -240,7 +240,7 @@ void GuiScraperSearch::resizeMetadata()
{
mMD_Grid->setSize(mGrid.getColWidth(2), mGrid.getRowHeight(1));
if (mMD_Grid->getSize().y > mMD_Pairs.size()) {
const int fontHeight {static_cast<int>(mMD_Grid->getSize().y / mMD_Pairs.size() * 0.8f)};
const float fontHeight {mMD_Grid->getSize().y / mMD_Pairs.size() * 0.8f};
auto fontLbl = Font::get(fontHeight, FONT_PATH_REGULAR);
auto fontComp = Font::get(fontHeight, FONT_PATH_LIGHT);

View file

@ -248,8 +248,8 @@ void HelpComponent::updateGrid()
mGrid->setSize(width, height);
for (size_t i = 0; i < icons.size(); ++i) {
const size_t col {i * 4};
for (int i = 0; i < static_cast<int>(icons.size()); ++i) {
const int col {i * 4};
mGrid->setColWidthPerc(col, icons.at(i)->getSize().x / width);
mGrid->setColWidthPerc(col + 1,
(mStyle.iconTextSpacing * mRenderer->getScreenWidth()) / width);