EngoEngine / engo

Engo is an open-source 2D game engine written in Go.
https://engoengine.github.io
MIT License
1.75k stars 136 forks source link

Problems with engo.WindowSize and ScaleOnResize when minimized #689

Open inkeliz opened 4 years ago

inkeliz commented 4 years ago

There's two issues noticed so far when you minimize the game (ALT + TAB) and return to the game.


Black Screen

If you use the follow RunOptions:

opts := engo.RunOptions{
    Title:         "Test",
    Fullscreen:    true,
}

The game will have a "Black Screen" (or the color defined by common.SetBackground), so the content of the game willl not display anymore when you minimize and return to the game.

The fix for that is using ScaleOnResize: true. Maybe we must enforce that FullScreen always set the ScaleOnResize to true.

WindowSize is 0, 0 when minimize:

While the game is minimized the engo.WindowSize will return 0, 0. It kind of makes sense, but it seems strange. Because it ignores the value of NotResizable. If the game is NotResizable is expected that the size never changes. Also, it maybe could have another function like engo.IsMinimized(), to pause the game (or slowdown the game) when it's hidden.

inkeliz commented 4 years ago

Disabling the glfw.AutoIconify fix that:

glfw.WindowHint(glfw.AutoIconify, 0)

However, it also prevent from minimize the window.