All Questions



Window size and scaling affects sprite offset

Hi there, I encountered a graphic bug while running the final version of the simulation game within Godot. In each window mode other than full screen, the images for the building previews have a huge offset. I'm running Windows 10 with a display scaling of 125 %. With a display scaling of 100 %, the offset becomes smaller, but it is still not zero.

Also, the game window is not centered, but more in the bottom right corner of my screen; although the window place is set to 'centered' in the editor settings. I have to manually move the window at start each time, because it is not completely visible. This is a general problem and not specific to this game. 

  • Razoric replied

    The preview offset is a bug in Godot where Canvas Layers do not get the memo that the screen has been resized, so input does not match position even with a canvas transform. You can hack your way around it by moving the drag preview out of the canvas layer and back to a Node2D as a child of entity placer, then removing the call to getting the viewport transform and using xform().

    That godot's UI nodes get affected by Windows' display scaling is news to me! I did not know that. But yes, I can imagine it would exarcebate the issue. Related issue:

    As for the game window, I've never encountered that. Do you have a hidden second desktop? E.G. a drawing tablet with a screen, or a laptop? That might change what is the 'middle of the screen' for Windows. But that it ends up in the corner is strange.

    Do you have a high-DPI laptop? Maybe related issue:

  • H
    Thomas replied

    Thanks for the answer! 

    The second problem with the game window could be solved by enabling the "Allow Hidpi" setting under project settings :) Thanks for the hint. I'm running Godot on a notebook with 1920x1080 without any other display. 

    The offset bug is still there in window mode, but the offset is now smaller due to the enabled "Allow Hidpi" setting. The preview images aren't affected by the display scaling anymore. I didn't resize the screen, the bug already occured when starting the game in window mode. This bug seems to be quite old already, the Github issue is two years old. Maybe it gets fixed in a future version, but for now full screen mode does the job for me :)