I understand you can set a minimum and maximum window size in gdscript, for the situation when your application is running on a desktop or laptop and is resizable. i.e.
OS.min_window_size = Vector2(500, 500)
OS.max_window_size = Vector2(6000, 4000)
How does this translate into iOS with retina screens. Does the minimum and maximum size represent the physical pixel width, or the logical pixel width? The documentation doesn't make this clear:
First of all, there is an option in Project Setting called "Allow Hidpi" which you should enable to use OS scaling. It does not really cause problems, but it is disabled by default in Godot 3.x because of backwards compatibility.
Now, you can query
OS.get_screen_dpi(),OS.get_screen_scale()andOS.get_screen_max_scale()to find out about the scaling the game is currently at.And, you are correct, the documentation does not specify if
min_window_sizeandmax_window_sizeare before or after that scaling…The answer: I'm convinced that
min_window_sizeandmax_window_sizeare after scaling (at any scaling, not at the current scaling). Which - if I understand correctly - is physical pixels.The figuring out of the answer
From here on, this answer is figuring out what I claim above.
Now, I believe that in iOS Godot will always be in full screen mode. In which case
min_window_sizeandmax_window_sizeare ignored.So, instead of looking at iOS, this is
set_max_window_sizefor OSX (source):So, let us see…
So far so good.
Then we have this
zoomedfield. As far as I can tell it is set to true on full screen, and false otherwise.Thus, this is the logic we are looking for:
It is something like this (pseudo code):
OS_max_size = max_size / max_scaling.Ok, now I want to see
setContentMaxSize:Ok, there are four possibilities:
setContentMaxSizesets the maximum size in pixels before scaling. Andmax_window_sizeis the maximum size in pixels before scaling.If this was the case, we would set it directly. So, this isn't the case.
setContentMaxSizesets the maximum size in pixels before scaling. Andmax_window_sizeis the maximum size in pixels after scaling.If this was the case, we would have to divide
max_window_sizeby the scaling. So, this could be it.setContentMaxSizesets the maximum size in pixels after scaling. Andmax_window_sizeis the maximum size in pixels before scaling.If this was the case, we would have to multiply
max_window_sizeby the scaling. So, I don't this is the case.setContentMaxSizesets the maximum size in pixels after scaling. Andmax_window_sizeis the maximum size in pixels after scaling.If this was the case, we would set it directly. So, this isn't the case.
Therefore, unless this is a bug,
max_window_sizeis the size in pixels after scaling. And that is the maximum size in pixels at any scaling instead of the current one since it usesget_screen_max_scale()instead ofget_screen_scale(). Andmin_window_sizewould work the same way. *