-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a way to customize Window parameters before it first appears #6247
Comments
Indeed #3145 looks very similar, but my implementation details are more concrete. |
Another use-case for this I've run into is related to hiDPI scaling (see #7968) when using a small size splash window as described above. Post launch you can manually scale windows using content scale factor and the window size to get it to appear like the system display scale, but the startup splash window will appear tiny on hiDPI monitors since you can't change that. And if you make the splash window size and image larger it'll instead look too big on non-hiDPI monitors. Regarding the technical solution for this I think since the configuration possibilities of windows are quite limited (mode, scaling, placement etc) a simpler system without full startup_scripts or SceneTree subclass methods could be enough. I think an option to reuse the last used window properties would catch the majority of these cases? In other words have the engine save the state of the main window in a file somewhere when shutting down, and if the option is enabled and the file available use this at startup to configure the window. This would also be a nice service to developers as it would reduce/remove the need to save and restore window size/mode settings that more or less all games have. |
Describe the project you are working on
An actual game made with Godot D:
Describe the problem or limitation you are having in your project
I want to have window size settings, like in pretty much every game. I have a config file where I save the player's preferences then the file is loaded on startup and applies the settings. My problem is that the settings are loaded after the window is initialized. So e.g. if my game is set to fullscreen in project settings and someone wants windowed, the game will still start in fullscreen and only switch after everything is loaded.
One workaround is using
override.cfg
, but the problem is that if I want to change some project settings after I create this file, it will get in my way.Another one, which is quite elegant actually, is to start windowed and setting the window size to some low value. The game will display a small splash screen and then resize to the target size. While this is nice, most games don't do that, so it shouldn't be a necessity.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I think we need some way to setup the window before it appears. Some kind of script or something that runs before everything else and allows you to customize the initial window parameters.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I have 2 ideas for an implementation:
_init()
is too late)Not sure how these solutions are doable, because the Window initialization takes place in SceneTree's constructor, so running virtual methods or script might be not possible. In worst case it would require moving the initialization to a later stage (probably using message queue).
If this enhancement will not be used often, can it be worked around with a few lines of script?
Every game needs this. But yes, it can be worked around, although the current solutions are not perfect.
Is there a reason why this should be core and not an add-on in the asset library?
Can't be an addon.
The text was updated successfully, but these errors were encountered: