Skip to content
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

Game issues when switching window between fullscreen and windowed mode #932

Open
SoulRider opened this issue Dec 4, 2020 · 2 comments
Open
Labels
area-Graphics bug Something isn't working priority-high High priority needs to be fixed or done in release work-estimate-S Good for first timers. A relatively quick item to fix, Max of 2x of XS

Comments

@SoulRider
Copy link

SoulRider commented Dec 4, 2020

Official Release

Version: Stride 4.0.0.1 beta04 1317

Platform(s): Windows

Describe the bug
There are multiple issues when it comes to trying to switch screen using winforms as the window renderer. Switching from windowed mode to fullscreen mode using the method game.Windows.IsFullscreen = bool will work 99.9% of the time, very occassionally ending with a NullReference in Stride.Graphics.SwapChainGraphicsPresenter.OnDestroyed();

image

When trying to go from fullscreen to windowed mode the system destroys the window, but seemingly a new one is not created, and the game continues to run as a background process, having to be killed in task manager. game.Windows.IsFullscreen as a swap method respects the PreferredFullscreenSize & PreferredWindowedSize values set earlier in the code.

Using game.GraphicsDeviceManager.IsFullScreen as the method to change also only works going from a windowed screen to fullscreen, although this method just seems to make the current resolution fullscreen and does not respect PreferredFullscreenSize settings.

To Reproduce
The following code is where I experience the error:

        public override void Update()
        {
            if (toggleWindow)
            {
                bool toggle = game.Window.IsFullscreen;
                toggle = !toggle;
                
                game.Window.IsFullscreen = toggle;
                Settings.SetIsFullscreen(toggle);
                toggleWindow = false;
            }
}

Expected behavior
The window to switch between fullscreen and windowed mode as apprpriate and for PreferredFullscreenSize & PreferredWindowedSize values to be respected.

Screenshots
Here is a link to a video showing the window not coming back up after switching from fullscreen to windowed mode.

https://youtu.be/5klndyDkLX8

@SoulRider SoulRider added the bug Something isn't working label Dec 4, 2020
@bmello4688 bmello4688 added priority-high High priority needs to be fixed or done in release work-estimate-S Good for first timers. A relatively quick item to fix, Max of 2x of XS labels Jan 5, 2021
@SoulRider
Copy link
Author

SoulRider commented Feb 14, 2021

I have had a 33% return rate on my game due to this issue. I have been able to get some further information including event viewer logs, but this is a serious issue. Note in my game I only go from the default intro window to fullscreen at launch, no other changes.

Please see some event viewer logs on this issue:

image

image

image

@tebjan
Copy link
Member

tebjan commented Feb 14, 2021

I think Winforms isn't the recommended windowing system, SDL has seen more fixes recently. Just switch to SDL and set how it works. It also has FullscreenIsBorderlessWindow which would allow switching between apps while in fullscreen.

Also, it's not recommend to use the methods of the graphics device manager. Only talk to the window. That's how we currently do it and it's quite smooth and reliable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Graphics bug Something isn't working priority-high High priority needs to be fixed or done in release work-estimate-S Good for first timers. A relatively quick item to fix, Max of 2x of XS
Projects
None yet
Development

No branches or pull requests

4 participants