Open okla opened 1 year ago
Regarding window_resized...
get_viewport().size_changed.connect()
Regarding window_resized...
get_viewport().size_changed.connect()
As another workaround, yes. But window and root viewport are different things, maybe they can even have different sizes or change size independently of each other in some cases.
Added a mode_changed
signal/callback.
But window and root viewport are different things
This is incorrect. The root viewport IS the window of the first window.
https://docs.godotengine.org/en/latest/classes/class_scenetree.html#class-scenetree-property-root
That workaround is the intended method, and for any subviews you create you then of course already have a reference to them to connect the signals from.
We could perhaps consider a better property name? SceneTree.main_window? Side by side with SceneTree.root, (which is redundant, but would clear up any confusion that might exist.)
Or maybe a DisplayServer.get_main_window() (though you can already get it through get_window_list()[0])
Size is the only one that has a NOTIFICATION_WM equivalent. I would love to see one for position and fullscreen. Especially since I learned that mac let you change fullscreen by pressing a button.
Describe the project you are working on
Flight sim with a possible windowed mode
Describe the problem or limitation you are having in your project
When game is in windowed mode I need to track window position/size/mode to save and restore them on next launch. Currently, I check them for changes in
_process()
which is cumbersome and bad for performanceDescribe the feature / enhancement and how it helps to overcome the problem or limitation
I propose to add a several signals or callbacks to
DisplayServer
which would be more straightforward than using_process()
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I think it may look like signals
or like callbacks
If this enhancement will not be used often, can it be worked around with a few lines of script?
Look the described current solution
Is there a reason why this should be core and not an add-on in the asset library?
I don't think this can be done with an add-on