I have fairly recently joined a team developing juce based plugins which use png images for all aspects of the GUI.
My predecessor had used a simple system that got a scale factor by using Desktop::getInstance().getDisplays().getMainDisplay()->scale and then created the GUI using a set of either 100% or 200% images depending on the scale factor.
We have only very recently moved to using juce 6, where getMainDisplay is replaced with getPrimaryDisplay, which always returns 1.0 on Windows because of changes in win32_Windowing.
It is possible to workaround this by calculating a scale from the global dpi to keep our basic method working, but it is far from ideal.
I have found setScaleFactor in AudioProcessorEditor which seems like a better approach to use, but I think this is only called via VST wrappers?
So, my question is, what is the best way to determine the scale factor for either a ‘primary’ monitor, or the current monitor, that will work with all wrapper types on both Mac and Windows?
We are currently overhauling our supporting code framework alongside the move to juce 6, so we could also consider a more sophisticated method of dynamically switching assets when a plugin is dragged between monitors and/or also support non-integer scale factors between 1 and 2, so any other suggestions are very welcome.
Thank you for any help, even if it is just to point me towards some obvious documentation I have missed