0 votes

I am using this to set the game window to the top left corner of the screen:

OS.set_window_position(Vector2 (0,0))

However, the window appears a few pixels to the right. Playing around with it, I have found that a Vector2 (-7,0) will stick the window to the top left corner. Is there an offset? and if so, is it because the game is running in windowed mode?

I do not want to use fullscreen mode or maximize the window, though. Maybe there is a better way/method to achieve this?

Thanks for your attention!

asked Aug 3, 2019 in Engine by Mentuhetep (21 points)

I have been trying more stuff since I posted this question.

In borderless mode there are no issues whatsoever. Both OS.getwindowsize() and OS.getrealwindowsize() return the same value (as expected), and OS.setwindow_position(Vector2(0,0)) sets the window at the top left corner perfectly.

In windowed mode, however, OS.getwindowsize() and OS.getrealwindow_size() return a difference of 18x47, that I assume corresponds to the frame of the window, and might vary in each OS and computer. However, in my case, the left and right frames of the window are only 1 pixel wide, which means there is a gap of 8 pixels when trying to position the window at (0,0).

My question will be, is this something intended by Godot or calculated by the OS? Does this extra framing gap is fixed, or changes with a different OS / different computer?

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.