ebiten: Change the default value of IsRunningOnUnfocused to be true

Fixes #1180
This commit is contained in:
Hajime Hoshi 2020-10-07 00:30:46 +09:00
parent d0ee71a069
commit 41cf90a321
4 changed files with 7 additions and 9 deletions

View File

@ -151,7 +151,6 @@ func (m *mascot) Draw(screen *ebiten.Image) {
func main() {
ebiten.SetScreenTransparent(true)
ebiten.SetWindowDecorated(false)
ebiten.SetRunnableOnUnfocused(true)
ebiten.SetWindowFloating(true)
ebiten.SetWindowSize(width, height)
if err := ebiten.RunGame(&mascot{}); err != nil {

View File

@ -92,6 +92,7 @@ const (
var (
theUI = &UserInterface{
runnableOnUnfocused: true,
origPosX: invalidPos,
origPosY: invalidPos,
initVsync: true,

View File

@ -46,6 +46,7 @@ type UserInterface struct {
}
var theUI = &UserInterface{
runnableOnUnfocused: true,
sizeChanged: true,
vsync: true,
initFocused: true,

7
run.go
View File

@ -153,9 +153,6 @@ func (i *imageDumperGameWithDraw) Layout(outsideWidth, outsideHeight int) (scree
// TPS (ticks per second) is 60 by default.
// This is not related to framerate (display's refresh rate).
//
// game's Update is not called when the window is in background by default.
// This setting is configurable with SetRunnableOnUnfocused.
//
// On non-GopherJS environments, RunGame returns error when 1) OpenGL error happens, 2) audio error happens or
// 3) f returns error. In the case of 3), RunGame returns the same error.
//
@ -286,8 +283,8 @@ func IsRunnableOnUnfocused() bool {
// SetRunnableOnUnfocused sets the state if the game runs even in background.
//
// If the given value is true, the game runs in background e.g. when losing focus.
// The initial state is false.
// If the given value is true, the game runs even in background e.g. when losing focus.
// The initial state is true.
//
// Known issue: On browsers, even if the state is on, the game doesn't run in background tabs.
// This is because browsers throttles background tabs not to often update.