When resizing the window of my game the game doesn’t sit flush against either the top and bottom or sides and larger than necessary black borders appear.
Here is a video showing the issue better than I can describe it.
I’m using Godot 4.2 on macOS Catalina (10.15.7) and I have the following settings for Project Settings > General > Display > Window:
Viewport Width: 640
Viewport Height: 360
Window Width Override: 2560
Window Height Override: 1440
Stretch Mode: canvas_items
Aspect: keep
Scale: 1
Scale Mode: integer
I’ve downloaded other games that have these settings and they don’t appear to snap like this one and the content typically keeps its aspect ratio whilst filling the width or height of the window rather then snapping further into the window than necessary.
I’ve tried setting stretch mode to viewport which is recommended for 2d pixel art games but the issue still persists and movement of my character becomes blurry so I’ve stuck with canvas_items.
Note that fractional scaling will result in uneven pixel scaling, as viewport stretch mode always uses nearest-neighbor filtering. There’s currently no option to use sharp bilinear filtering instead, which would alleviate the issue (at the cost of overall slight blurriness).
Therefore, I really don’t recommend using fractional for pixel art games.
I’m using canvas_items as it appears to be much more crisp than the viewport scaling option even though it goes against the docs recommendations. I assume it’s due to what you’ve mentioned.