OpenTK: Detect display's DPI
-
21-12-2019 - |
Question
I want to use different scaling for my game if it's running on a Retina display. How do I detect display's DPI with OpenTK/C#?
Solution
I found a solution for differentiating between Retina and normal scale on the following page: https://github.com/opentk/opentk/issues/47
Scale factor is calculated with the following code and returns 1 for non-retina and 2 for Retina (at least in OS X):
// game is derived from GameWindow and screenSize
// is given as a parameter for its constructor.
var scale = game.Width / (float)screenSize.X;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow