So I have my viewport setup in project settings as 1152x648, and I even have the window size overrides as 1152x648.
In my script, I have:
func _ready():
var window := get_window()
print("window.size=", window.size)
and on startup, I see window.size=(1152,648) in the console.
BUT my window is tiny, and measures 688x464 pixels (that probably includes some window borders or something, it’s based on taking a grab of the window to measure its size).
So in OS X, window pixels don’t seem to relate to actual window size?
Does this happen in Linux or Windows, or is it a Mac specific issue, or am I just missing something here?
Are you using a multi-monitor setup? Which scale factor are you using in the macOS display settings? Using scaling will affect the physical size of the window, as Godot currently doesn’t adjust it automatically (unless using fullscreen).
Yes, I’m running the laptop screen and a thunderbolt display.
My take-away is I should not worry about this issue at this time; I’ll play around with running full screen and worry about non-full-screen when I’m past prototype stage.
I was also a little confused by this at first being used to working with macOS retina scaling where the windows/controls are sized in some nominal pixel units and the upscaling to higher resolution (and more pixels) is under the hood when rendering to the screen. As this makes more sense to me I’ve set up a little script to emulate this behavior on my windows in godot that you might be able to use as well:
to get the screen resolution scale, and then then scale both the window size and and set the content scale using that:
if (window.content_scale_factor != retina_scale):
#we need to change, calculate the relative change in scale
var relative_scale:float = retina_scale / window.content_scale_factor
#apply the change, as well as resizing window based on previous scale and relative scale
window.content_scale_factor = retina_scale
window.size = window.size*relative_scale
It works quite well, and I’ve even set it up using the node_added signal on the main tree to catch and correctly scale up popup windows like tooltips as they’re added.
Any news on this subject? Deactivating hiDPI doesn’t work for me. It’s quite frustrating to see the viewport representation in the editor at one size and running the game only shows half of that…