Is there any way to stop the window resize flicker upon running the game?

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

Due to Project Settings the window size is initially 1024x600, so you change it in game using OS.set_window_size() to be dynamically based on the user’s desktop resolution using OS.get_screen_size(), but this creates a flicker where it is initially 1024x600 for a brief moment.

This is really ugly in software which is opened and closed a lot of times, like if you’re making an image viewer.

:bust_in_silhouette: Reply From: Mxt08

You can use the following. Is a bit ugly, but is the only solution that I see to your problem:
OS.window_minimized = true OS.set_window_size(1024, 600) OS.window_minimized = false

That doesn’t work. Does it even work for you?

rainlizard | 2021-03-23 21:09

:bust_in_silhouette: Reply From: rainlizard

I figured out that setting Borderless to true in Project Settings, then setting it to false in _ready() is fixing it. (don’t forget to save the project in order to apply the Project Setting!)

It’s possible that this issue is only present on Windows, I don’t know.

Here’s some other tricks:

Put the window off screen: OS.set_window_position(Vector2(1000000000,1000000000))
Then do a bunch of yield(get_tree(), "idle_frame")
Until your window is loaded, then do: OS.center_window()

Using OS.window_minimized seems to prevent OS.set_window_size from working when used on the same frame so I don’t bother with it.

To disable the “Boot Splash”, set the Image filename to a nonsense filename that doesn’t exist. (again, don’t forget to save the project in order to apply Project Settings)

To disable the “Boot Splash”, set the Image filename to a nonsense filename that doesn’t exist. (again, don’t forget to save the project in order to apply Project Settings)

It’s better to use a 1×1 black or transparent PNG instead to avoid errors in the console when running the project. See this proposal.

Calinou | 2021-03-24 14:50

Setting it to a 1x1 black or transparent PNG is not hiding the Boot Splash. The “Bg Color” option of the Boot Splash cannot be made transparent, so it doesn’t matter how small you make the image, the Bg Color will always be visible. “Fullsize” option only affects the size of the image shown in the middle of the Bg Color background.

It looks like this: https://i.imgur.com/XD6lqyn.png
The red is the Boot Splash “Bg Color”.
Godot Icon is the Boot Splash “Image” and can be replaced with a 1x1 image or transparent PNG, won’t make a difference.

You can hide both the Bg Color and the Boot Splash image by using the nonsense filename method (I don’t mind some errors as long as it’s hidden) plus setting the window to be initially Borderless (set back to false in _ready). If you don’t use Borderless then the Boot Splash with nonsense filename will be white but if you do then it’ll be completely invisible.

To clarify, the Borderless setting is now fixing TWO different issues here. The Boot Splash and the initial resizing.

rainlizard | 2021-03-24 21:59