Mouse Screen Y Coordinates Different: HTML5 & Android?(SOLVED)

#1

Hi,

Bottom code works as expected on desktop & HTML5 builds.
Bottom code does not work as expected on Android build?

if action_id == hash("ClickGUI") and mY < 575 then
	PlayerDirection = -1
else
	PlayerDirections = 1
end

Screen vertical size is 640.
“mY” is a global variable with current mouse screen Y.

Seems like screen vertical coordinates are reversed on Android?
Can someone confirm this?
Thanks!

Jesse

0 Likes

#2

No, the coordinates are not reversed. Bottom left is always 0,0 and top right is always window width, height.

0 Likes

#3

Ok, thanks…
Must be something in my code.
I’ll hit it with a hammer.

Jesse

0 Likes

#4

Wouldn’t it be easier to create two transparent(invisible) buttons and gui.pick_node, also taking into account the adjust_mode in your GUI.

0 Likes

#5

@britzl is it possible to change the adjust_mode of all nodes in a single line of code, rather than changing them one by one with:

gui.set_adjust_mode(each_node, mode)
0 Likes

#6

No, that’s the function to use. You could create your own utility function and pass in a list of nodes or something.

1 Like

#7
if action_id == hash("ClickGUI") and mY * (640/WindowHeightTrue) < 575 then
	PlayerDirection = -1
else
	PlayerDirections = 1
end
0 Likes