0 votes

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.

in Engine by (75 points)

2 Answers

–1 vote
Best answer

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)

by (75 points)
edited by

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.

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.

0 votes

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

by (353 points)

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

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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.