Mouse location gets confused on secondary monitor


Running this on a MacBook Pro with secondary monitor. The project has a width of 640 and height of 960.
I’m having the editor on the built in monitor, doing a build and run. When I click on the four corners of the test window I get reasonable values for X and Y:

DEBUG:SCRIPT: X,Y = 13.25 13.192993164063
DEBUG:SCRIPT: X,Y = 11.75 944.56140136719
DEBUG:SCRIPT: X,Y = 625.75 941.19299316406
DEBUG:SCRIPT: X,Y = 621.25 13.75439453125

When I move the test window to the external monitor (placed above the build in) it seems that both X and Y is scaled down by two and that the Y has also around 480 added to it (half game height?)

DEBUG:SCRIPT: X,Y = 9.25 487.57894897461
DEBUG:SCRIPT: X,Y = 9.75 949.05261230469
DEBUG:SCRIPT: X,Y = 314.25 951.85961914063
DEBUG:SCRIPT: X,Y = 314.25 489.82455444336

When I’m running the editor on the external monitor the test window works ok when staying on the external, and when moving to the built in. But, if I then move it back to the external it has the same behavior as when it started on internal monitor.

From what it looks a built application on OsX has the same behavior.

My script code is just this, attached to a single go in the collection.

function init(self)".","acquire_input_focus")

function on_input(self, action_id, action)
	if action.pressed then
		print("X,Y = " .. action.x .. " " .. action.y )


I’ll take a look next week. I’m pretty sure we do nothing to detect if the window is moved to another monitor. What you’re seeing is probably a result of retina vs non retina monitor.

1 Like


Yes, that sounds reasonable.
This is not a high priority as such since my main goal are phones anyway but the behavior was rather confusing for a while :slightly_smiling_face:

1 Like