summaryrefslogtreecommitdiff
path: root/src/video/sdl2_v.cpp
diff options
context:
space:
mode:
authorsean <43609023+spnda@users.noreply.github.com>2021-03-09 10:22:52 +0100
committerGitHub <noreply@github.com>2021-03-09 10:22:52 +0100
commit0464a50ab8f5f6c7028da80cb0d579cdfc84717a (patch)
tree2bacc79fb89d9140f7edcca56a5cf82a943f3524 /src/video/sdl2_v.cpp
parent64a8c38d2f08de5aee6315e5746cbe5ec73da9e3 (diff)
downloadopenttd-0464a50ab8f5f6c7028da80cb0d579cdfc84717a.tar.xz
Add: Display refresh rate game option (#8813)
Diffstat (limited to 'src/video/sdl2_v.cpp')
-rw-r--r--src/video/sdl2_v.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp
index 62675280c..2d8558534 100644
--- a/src/video/sdl2_v.cpp
+++ b/src/video/sdl2_v.cpp
@@ -237,6 +237,17 @@ void VideoDriver_SDL_Base::EditBoxLostFocus()
}
}
+std::vector<int> VideoDriver_SDL_Base::GetListOfMonitorRefreshRates()
+{
+ std::vector<int> rates = {};
+ for (int i = 0; i < SDL_GetNumVideoDisplays(); i++) {
+ SDL_DisplayMode mode = {};
+ if (SDL_GetDisplayMode(i, 0, &mode) != 0) continue;
+ if (mode.refresh_rate != 0) rates.push_back(mode.refresh_rate);
+ }
+ return rates;
+}
+
struct SDLVkMapping {
SDL_Keycode vk_from;