I’m trying to set up basic window options for Fullscreen, and Windowed.
The game starts in fullscreen, but when I hit the windowed button I get inconsistent behavior. The first time I hit it, the screen flickers like it’s doing something, but it seems to still be in fullscreen mode (no header bar).
However, if I press the fullscreen button and then press the windowed button again, now it is in windowed mode, filling the whole screen aside from the OS header, with the window header present.
If I repeat this one more time, pressing the fullscreen button and then the windowed button once more, it does go to windowed mode, but now the window is smaller and sized to about a quarter of the screen size.
Any idea what could be causing this? I’m using fairly basic code here:
For Windowed: DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
Added note:
This occurs whether I use Fullscreen or Exclusive Fullscreen. I also saw that fullscreen forces the borderless flag to true, so I accounted for that when switching to windowed mode.
Second note:
I switched from a button based approach to a OptionButton based one and it works as expected. So weird. I’d still like to try to figure out why the buttons don’t work properly, but at least I have something working.
That’s strange that it would work for OptionButton but not Button. I also use the option dropdown and it has worked for me.
The first thing I think of would be embedding your window in the editor. I know that doesn’t play nice with switching the video settings around, though I’m not too familiar as I no longer have my project embed the game.
There’s the obvious possibility that there was a slip-up with an extra connection or a typo or something and redoing it fixed the issue.
Maaybe the signal you were using for button was wrong and picking up multiple inputs? Doesn’t seem like that would be the case though.
Seems like you figured it out, but in-case someone else needs it as reference you set the borderless window flag to false with this: