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

ebiten: ScreenSizeInFullscreen should return a monitor size on browsers #2145

Closed
hajimehoshi opened this issue Jun 16, 2022 · 2 comments
Closed
Milestone

Comments

@hajimehoshi
Copy link
Owner

As there is a fullscreen mode on browsers, ScreenSizeInFullscreen should return a monitor size instead of a window frame size.

diff --git a/internal/ui/ui_js.go b/internal/ui/ui_js.go
index a73dd24c4..93f206b9a 100644
--- a/internal/ui/ui_js.go
+++ b/internal/ui/ui_js.go
@@ -99,6 +99,7 @@ func init() {
 var (
        window                = js.Global().Get("window")
        document              = js.Global().Get("document")
+       screen                = js.Global().Get("screen")
        canvas                js.Value
        requestAnimationFrame = js.Global().Get("requestAnimationFrame")
        setTimeout            = js.Global().Get("setTimeout")
@@ -119,7 +120,7 @@ func init() {
 }
 
 func (u *userInterfaceImpl) ScreenSizeInFullscreen() (int, int) {
-       return window.Get("innerWidth").Int(), window.Get("innerHeight").Int()
+       return screen.Get("width").Int(), screen.Get("height").Int()
 }

As this is a breaking-change, I'll introduce the fix to v3.

@hajimehoshi
Copy link
Owner Author

We can deprecate this function by #1835

@hajimehoshi hajimehoshi modified the milestones: v3.0.0, v2.7.0 Mar 23, 2024
@hajimehoshi
Copy link
Owner Author

#2795 (*Monitor).Size can return this value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant