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

View file

@ -240,7 +240,7 @@ void GuiScraperSearch::resizeMetadata()
{ {
mMD_Grid->setSize(mGrid.getColWidth(2), mGrid.getRowHeight(1)); mMD_Grid->setSize(mGrid.getColWidth(2), mGrid.getRowHeight(1));
if (mMD_Grid->getSize().y > mMD_Pairs.size()) { 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 fontLbl = Font::get(fontHeight, FONT_PATH_REGULAR);
auto fontComp = Font::get(fontHeight, FONT_PATH_LIGHT); auto fontComp = Font::get(fontHeight, FONT_PATH_LIGHT);

View file

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