diff --git a/input.go b/input.go index 5144974a9..0dc51629d 100644 --- a/input.go +++ b/input.go @@ -81,6 +81,10 @@ func IsKeyPressed(key Key) bool { // CursorPosition returns a position of a mouse cursor relative to the game screen (window). The cursor position is // 'logical' position and this considers the scale of the screen. // +// CursorPosition returns (0, 0) before the main loop on desktops and browsers. +// +// CursorPosition always returns (0, 0) on mobiles. +// // CursorPosition is concurrent-safe. func CursorPosition() (x, y int) { return uiDriver().Input().CursorPosition() diff --git a/internal/uidriver/mobile/input.go b/internal/uidriver/mobile/input.go index c6146bc5a..22586db28 100644 --- a/internal/uidriver/mobile/input.go +++ b/internal/uidriver/mobile/input.go @@ -26,8 +26,6 @@ type pos struct { } type Input struct { - cursorX int - cursorY int keys map[driver.Key]struct{} runes []rune touches map[driver.TouchID]pos @@ -36,9 +34,7 @@ type Input struct { } func (i *Input) CursorPosition() (x, y int) { - i.ui.m.RLock() - defer i.ui.m.RUnlock() - return i.ui.adjustPosition(i.cursorX, i.cursorY) + return 0, 0 } func (i *Input) GamepadIDs() []driver.GamepadID {