From 97a9347d6795c7f20c14cea81bae1cb445c1749e Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 25 Oct 2022 01:06:02 +0200 Subject: [PATCH] Improved font sizing for the launch screen, scraper and help system. --- es-app/src/guis/GuiLaunchScreen.cpp | 17 ++++++++--------- es-app/src/guis/GuiScraperSearch.cpp | 2 +- es-core/src/components/HelpComponent.cpp | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/es-app/src/guis/GuiLaunchScreen.cpp b/es-app/src/guis/GuiLaunchScreen.cpp index af5955a56..76ea4a1c2 100644 --- a/es-app/src/guis/GuiLaunchScreen.cpp +++ b/es-app/src/guis/GuiLaunchScreen.cpp @@ -55,8 +55,8 @@ void GuiLaunchScreen::displayLaunchScreen(FileData* game) // Title. mTitle = std::make_shared( "LAUNCHING GAME", - Font::get(static_cast( - 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( "GAME NAME", - Font::get(static_cast( - 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(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; diff --git a/es-app/src/guis/GuiScraperSearch.cpp b/es-app/src/guis/GuiScraperSearch.cpp index f426ec1f6..202b16af1 100644 --- a/es-app/src/guis/GuiScraperSearch.cpp +++ b/es-app/src/guis/GuiScraperSearch.cpp @@ -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(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); diff --git a/es-core/src/components/HelpComponent.cpp b/es-core/src/components/HelpComponent.cpp index bae9dfc05..4dcd468d6 100644 --- a/es-core/src/components/HelpComponent.cpp +++ b/es-core/src/components/HelpComponent.cpp @@ -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(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);