Add: Display refresh rate game option (#8813)
This commit is contained in:
@@ -47,6 +47,8 @@ public:
|
||||
|
||||
void EditBoxLostFocus() override;
|
||||
|
||||
std::vector<int> GetListOfMonitorRefreshRates() override;
|
||||
|
||||
/* --- The following methods should be private, but can't be due to Obj-C limitations. --- */
|
||||
|
||||
void MainLoopReal();
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
|
||||
#import <sys/param.h> /* for MAXPATHLEN */
|
||||
#import <sys/time.h> /* gettimeofday */
|
||||
#include <array>
|
||||
|
||||
/**
|
||||
* Important notice regarding all modifications!!!!!!!
|
||||
@@ -228,6 +229,30 @@ void VideoDriver_Cocoa::EditBoxLostFocus()
|
||||
HandleTextInput(nullptr, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get refresh rates of all connected monitors.
|
||||
*/
|
||||
std::vector<int> VideoDriver_Cocoa::GetListOfMonitorRefreshRates()
|
||||
{
|
||||
std::vector<int> rates{};
|
||||
|
||||
if (MacOSVersionIsAtLeast(10, 6, 0)) {
|
||||
std::array<CGDirectDisplayID, 16> displays;
|
||||
|
||||
uint32_t count = 0;
|
||||
CGGetActiveDisplayList(displays.size(), displays.data(), &count);
|
||||
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displays[i]);
|
||||
int rate = (int)CGDisplayModeGetRefreshRate(mode);
|
||||
if (rate > 0) rates.push_back(rate);
|
||||
CGDisplayModeRelease(mode);
|
||||
}
|
||||
}
|
||||
|
||||
return rates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the resolution of the main screen.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user