#When I set the size of my window to 1920x1080, it's automatically set to 1920x1071.

1 messages · Page 1 of 1 (latest)

carmine sorrel
#

Hello! I am trying to manage different resolutions in my game. The viewport initial width and height is set to 640x360, and I am using the integer scale mode so that it scales perfectly to 1280x720 and 1920x1080. It works great when the game is on fullscreen. But when I go to windowed and set the window size to 1920x1080, the console show it is actually being resized to 1920x1071, which is heavily noticeable because then the content is not scaled and it shows black bars all around the game.

The code I am using is this one:

DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
get_tree().root.size = resolution
get_tree().root.position = centered_position
print(resolution)
print(DisplayServer.window_get_size())

And it is printing the following:

(1920, 1080)
(1920, 1071)

I am guessing it is taking into account my computer's taskbar, but I don't know why it would be doing that, or if that behaviour is expected.

slim garnet
#

Or do DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, true)

carmine sorrel
#

Oh, you are right! Thank you for your answer. Hadn't thought about it. I knew it worked on fullscreen, but it also worked with the BORDERLESS_FLAG set to true. So it must be the title bar. Do you think there is a way to not keep it into account when resizing the window? I could set the window to borderless only when the resolution is the same as the screen size (which is why I suspect 1920x1080 is the only resolution that's giving me this problem), and it would technically solve this issue. But I don't think it is usual for a videogame to keep the border in some resolutions and not in others