Background wallpaper for fullscreen mode

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 9BitStrider

The game window for the project I’m working on doesn’t exactly fit the 16:9 aspect ratio (Unless you set it to be rotated 90 degrees). I’m learning about viewports as we speak but was wanting anyone’s opinion about how to handle background images that fill the remaining screen. Should I make the wallpaper node the main node with the game window as a viewport? Vice versa? How would you go about this?

:bust_in_silhouette: Reply From: estebanmolca

From what little I understand, the fullscreen mode is simulated, it creates a borderless window that adapts to the resolution of the monitor. If you test your project in the editor at a different resolution than your monitor, when you use fullscreen it will look different. In the project options where you configure fullscreen, last are the options to tell godot what to do with the content when the resolution changes. Try setting stretch / mode to 2d.
If I remember correctly in the manual there is a section explaining how to adapt the game to multiple resolutions.
For the background I would use a texture rect node as the first child of the scene. In its options you can scale your content, center it, keep the aspect ratio, etc.

Handling different aspect ratios in fullscreen is always a bit of a headache! I usually find that using a TextureRect set to ‘Expand’ with the ‘Keep Aspect Covered’ stretch mode works best to avoid those weird black bars on ultrawide monitors. One thing that’s helped me clean up my assets for these backgrounds is https://solidbg.com/. I’ve been using it to quickly strip backgrounds or clean up the edges of UI elements before importing them into the engine. It’s way faster than manually masking things in Photoshop when you just need a clean asset to test in your scene.

By the way, are you using the ‘Canvas Items’ stretch mode in your project settings, or are you trying to handle the scaling manually through code?