Closed Duxo closed 2 months ago
CursorPosition can return a mouse cursor position if you use a mouse for Android. There is no assumption that CursorPosition returns (0, 0) by default.
For touches, use the APIs for touches. https://pkg.go.dev/github.com/hajimehoshi/ebiten/v2#TouchID
The problem is that the CursorPosition() returned a different value than (0,0) on Android without the mouse. Also, the documentation says: "CursorPosition always returns (0, 0) on mobiles."
Sorry for sounding assertive; it is the most compact way I managed to write it.
Ah, yes, that seems an issue.
Also I was misunderstanding that Ebitengine detected a mouse for Android apps but was actually not (yet). I'm sorry, I'll take a look.
The confusing point is
I'll update the comment.
Ebitengine Version
v2.7.8
Operating System
Go Version (
go version
)1.23.1
What steps will reproduce the problem?
Game: (built with
env GOOS=js GOARCH=wasm go build -o test.wasm
)HTML:
What is the expected result?
I expected that ebiten.CursorPosition() will always return (0,0) on mobile.
What happens instead?
After the mobile screen is touched, the ebiten.CursorPosition() returns the coordinates of the touch.
Anything else you feel useful to add?
The problem is present in Firefox and Chrome.