refreshrate default value

This commit is contained in:
Irmen de Jong 2022-03-19 01:08:10 +01:00
parent 7d2bf892b1
commit 4c1bb18956

View File

@ -45,7 +45,9 @@ class GraphicsWindow(val pixelWidth: Int, val pixelHeight: Int, val pixelScaling
private fun optimalRefreshRate(frame: JFrame): Int { private fun optimalRefreshRate(frame: JFrame): Int {
var rate = frame.graphicsConfiguration.device.displayMode.refreshRate var rate = frame.graphicsConfiguration.device.displayMode.refreshRate
if(rate==0) if(rate==0)
rate = GraphicsEnvironment.getLocalGraphicsEnvironment().screenDevices.map { it.displayMode.refreshRate }.first { it>0 } rate = GraphicsEnvironment.getLocalGraphicsEnvironment().screenDevices
.map { it.displayMode.refreshRate }
.firstOrNull { it>0 } ?: 60
return max(30, min(250, rate)) return max(30, min(250, rate))
} }