Skip to content

Commit

Permalink
fixup! Add automatic GUI scale selection
Browse files Browse the repository at this point in the history
  • Loading branch information
falbrechtskirchinger committed Aug 10, 2023
1 parent d4c48c0 commit dd6096d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/s25main/desktops/dskOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,14 +760,14 @@ void dskOptions::scrollGuiScale(bool up)
const auto& selection = combo->GetSelection();
unsigned newSelection = 0;
if(!selection || *selection == 0) // No selection or "Auto" item selected
newSelection = recommendedGuiScaleIndex_ + 1;
newSelection = recommendedGuiScaleIndex_;

Check warning on line 763 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L758-L763

Added lines #L758 - L763 were not covered by tests
else
newSelection = std::clamp(*selection + (up ? 1 : -1), 1u, static_cast<unsigned>(combo->GetNumItems() - 1));

Check warning on line 765 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L765

Added line #L765 was not covered by tests

if(newSelection != selection)

Check warning on line 767 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L767

Added line #L767 was not covered by tests
{
combo->SetSelection(newSelection);
SETTINGS.video.guiScale = guiScales_[newSelection - 1];
SETTINGS.video.guiScale = guiScales_[newSelection];
VIDEODRIVER.setGuiScalePercent(SETTINGS.video.guiScale);

Check warning on line 771 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L769-L771

Added lines #L769 - L771 were not covered by tests
}
}

0 comments on commit dd6096d

Please sign in to comment.