How can I scale the boot splash image with the window if the window is resized first thing?

Godot Version

4.5.1

Question

In enter_tree() of my root node I am resizing the window based off of the monitor's dimensions with DisplayServer.window_set_size(). The splash screen is staying the size it would have been in the bottom right corner of the screen.

1 Like

Perhaps adjust your layouting options if you’re using control nodes. Hard to give specific advice without seeing your scene structure.

Normal (white) Node with a script attached, in enter_tree() is DisplayServer.window_set_size(Vector2i(1920,1080)). Superfluous code removed that’s the whole thing.

You should use Control nodes that take advantage of Godot’s layouting system. That way you’ll be able to set up a layout that automatically responds to window size/proportion changes in a predetermined way.

@normalized Control nodes don’t work with the boot splash. You can only use a background color and image.

@ectophasm do this:

  1. Go to Project → Project Settings
  2. Select the General tab (if not already selected).
  3. Select Application → Boot Splash.
  4. Check the Fullsize check box.

This will scale your image to the screen regardless of any changes to resolution, even while loading.

2 Likes

Time for me to go to bed.

3 Likes

It does not, I imagine because the boot splash is occurring before any code I’ve written myself could run. I guess my real question is how Godot could know the dimensions of the monitor before it reaches my root node.

Edit: I should probably mention that the image itself is scaled, but the problem I’m having with it is that it’s in the bottom-right corner and not centered.

It does not what? Scale?

Because Godot has a window manager.

And it’s either starting in fullscreen mode and using the monitor size or in windowed mode and using the window size set in Project Settings → Display ->Windows.

Well then that sounds like a problem with your image. How big is it? How big is the border around your image? Is the border only on the top and left of the logo you want centered?

It’s not my own image, it’s the template Godot robot in the bottom-right.

Here’s a clip that shows everything. I added a 1920x1080 image to see if that would center it after resizing the window to those dimensions, but it’s the same issue.

Well, what does your System.screen_size setter code look like?

Also, you should be using:

get_window().set_size(size)

Instead of :

DisplayServer.window_set_size(size)

It’s not a setter, just a global variable.

If I start the project with a 1920x1080 window or view port the image displays as intended so it’s definitely something about it being resized.

That answers my question. It’s not the issue.

For reference, a setter is the code that runs whenever you assign a value to any variable. The default setter makes it just equal to that value. But you can create custom ones. I thought perhaps you were using that assignment to do something. You are clearly not.

Did you make this change?

Might be the same issue:

I made the change though it didn’t visibly do anything.

To clear up confusion about the global, I imagine it is faster to store the current dimensions once than call a function that grabs it every time I need it.

Why not just start in fullscreen mode?

Because I want the user to have options, and I don’t like that I can’t do this.

If the user wants to boot up a game in windowed mode then I should be able to save that option in a config even if the first launch is in fullscreen and have it work as intended.

1 Like

Save it in project settings.

I can’t determine the window size for every user in Project Settings because I don’t know what monitor the user has.

I meant set the fullscreen flag in project settings, let the engine automatically stretch at startup.

1 Like