From 6e6bf1e77b1e205a7d43961faf175e3cf9a82474 Mon Sep 17 00:00:00 2001 From: Andrey Filipenkov Date: Mon, 26 Sep 2022 16:39:30 +0300 Subject: [PATCH] don't list resolutions larger than the current screen's in the game options --- client/windows/GUIClasses.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/windows/GUIClasses.cpp b/client/windows/GUIClasses.cpp index 33372b30b..302c61a0a 100644 --- a/client/windows/GUIClasses.cpp +++ b/client/windows/GUIClasses.cpp @@ -562,9 +562,15 @@ void CSystemOptionsWindow::selectGameRes() std::vector items; const JsonNode & texts = CGI->generaltexth->localizedTexts["systemOptions"]["resolutionMenu"]; + SDL_Rect displayBounds; + SDL_GetDisplayBounds(std::max(0, SDL_GetWindowDisplayIndex(mainWindow)), &displayBounds); + for(const auto & it : conf.guiOptions) { const auto & resolution = it.first; + if(displayBounds.w < resolution.first || displayBounds.h < resolution.second) + continue; + std::string resX = boost::lexical_cast(resolution.first); std::string resY = boost::lexical_cast(resolution.second); items.push_back(resX + 'x' + resY);