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: calling ScreenSizeInFullscreen panics on browsers #2975

Closed
2 of 11 tasks
tinne26 opened this issue Apr 30, 2024 · 3 comments
Closed
2 of 11 tasks

ebiten: calling ScreenSizeInFullscreen panics on browsers #2975

tinne26 opened this issue Apr 30, 2024 · 3 comments
Milestone

Comments

@tinne26
Copy link

tinne26 commented Apr 30, 2024

Ebitengine Version

v2.7.2

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • OpenBSD
  • Android
  • iOS
  • Nintendo Switch
  • PlayStation 5
  • Xbox
  • Web Browsers

Go Version (go version)

go1.22.2

What steps will reproduce the problem?

Compiling and executing the following program on the browser (e.g. $env:GOOS="js"; $env:GOARCH="wasm"; go build -o exec.wasm main.go):

package main

import "github.com/hajimehoshi/ebiten/v2"

type Game struct {}
func (*Game) Layout(w, h int) (int, int) { return w, h }
func (*Game) Update() error { return nil }
func (*Game) Draw(*ebiten.Image) {}

func main() {
	w, h := ebiten.ScreenSizeInFullscreen()
	_, _ = w, h
	err := ebiten.RunGame(&Game{})
	if err != nil { panic(err) }
}

I also tried with runtime.LockOSThread(), go1.18.10, both Firefox and Chrome, etc.; everything panics. Using Monitor().Size() works, though.

Sample Firefox error output:

panic: syscall/js: call of Value.Int on undefined
<empty string>
goroutine 1 [running]:
syscall/js.Value.float({{}, 0x0, 0x0}, {0x82666, 0x9})
	syscall/js/js.go:454 +0x10
syscall/js.Value.Int(...)
	syscall/js/js.go:471
github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).ScreenSizeInFullscreen(0x19bc008)
	github.com/hajimehoshi/ebiten/v2@v2.7.2/internal/ui/screensizeinfullscreen_js.go:19 +0x5
github.com/hajimehoshi/ebiten/v2.ScreenSizeInFullscreen(...)
	github.com/hajimehoshi/ebiten/v2@v2.7.2/run.go:358
main.main()
	./main.go:14 +0x6

What is the expected result?

No panic.

What happens instead?

Panic.

Anything else you feel useful to add?

No response

@tinne26 tinne26 added the bug label Apr 30, 2024
@hajimehoshi hajimehoshi added this to the v2.8.0 milestone Apr 30, 2024
@hajimehoshi
Copy link
Owner

What about Chrome?

@hajimehoshi
Copy link
Owner

hajimehoshi commented Apr 30, 2024

I could reproduce this even on macOS / Firefox and Chrome.

@hajimehoshi
Copy link
Owner

This worked with v2.6, so this is a regression.

@hajimehoshi hajimehoshi modified the milestones: v2.8.0, v2.7.3 Apr 30, 2024
@hajimehoshi hajimehoshi changed the title ScreenSizeInFullscreen() panics on browsers ebiten: calling ScreenSizeInFullscreen before RunGame panics on browsers Apr 30, 2024
@hajimehoshi hajimehoshi changed the title ebiten: calling ScreenSizeInFullscreen before RunGame panics on browsers ebiten: calling ScreenSizeInFullscreen panics on browsers Apr 30, 2024
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

2 participants