From 41cf90a321bea33361a408faf85e0f2b40946898 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 7 Oct 2020 00:30:46 +0900 Subject: [PATCH] ebiten: Change the default value of IsRunningOnUnfocused to be true Fixes #1180 --- examples/mascot/main.go | 1 - internal/uidriver/glfw/ui.go | 1 + internal/uidriver/js/ui.go | 7 ++++--- run.go | 7 ++----- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/examples/mascot/main.go b/examples/mascot/main.go index 8ac84517f..066def441 100644 --- a/examples/mascot/main.go +++ b/examples/mascot/main.go @@ -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 { diff --git a/internal/uidriver/glfw/ui.go b/internal/uidriver/glfw/ui.go index fd5f86e8f..bfebf6e4e 100644 --- a/internal/uidriver/glfw/ui.go +++ b/internal/uidriver/glfw/ui.go @@ -92,6 +92,7 @@ const ( var ( theUI = &UserInterface{ + runnableOnUnfocused: true, origPosX: invalidPos, origPosY: invalidPos, initVsync: true, diff --git a/internal/uidriver/js/ui.go b/internal/uidriver/js/ui.go index 12b1c6a54..79b0c52af 100644 --- a/internal/uidriver/js/ui.go +++ b/internal/uidriver/js/ui.go @@ -46,9 +46,10 @@ type UserInterface struct { } var theUI = &UserInterface{ - sizeChanged: true, - vsync: true, - initFocused: true, + runnableOnUnfocused: true, + sizeChanged: true, + vsync: true, + initFocused: true, } func init() { diff --git a/run.go b/run.go index 6aa2c93e7..84a62380b 100644 --- a/run.go +++ b/run.go @@ -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.