Display profiles, touches coordinates

I have a display profile called “iphone” with width and height 1920x1080.
In editor, I placed some GUI node at top-right corner. In runtime, that node report it position as 1920, 1080. So far so good.
When I run application, touches (or mouse clicks) at top-right corner have coordinates (x, y) same as display width and height in game.project file or same as actual screen width, height (screen_x, screen_y). Why is that? I expect what node position and touch coordinates be the same.
gui.pick_node function picks node properly only if x, y used and not screen_x, screen_y.
So, nodes always positioned in custom layout coordinates, but touches/clicks always in default layout coordinates (x, y) or actual screen coordinates (screen_x, screen_y). Something wrong with that.
This is tangled as hell.

Ok, I realized what is wrong.
Because we have different script types (.script & .gui_script) we also should receive different set of mouse&touch coordinates in those scripts. For now it is the same.

In .gui_script:
Now (wrong):
x The x value of a pointer device, if present.<- For now this value in default layout space.
y The y value of a pointer device, if present.<- For now this value in default layout space.
screen_x The screen space x value of a pointer device, if present.
screen_y The screen space y value of a pointer device, if present.

How it should be (correctly):
x Value in current (picked by the engine) layout space.
y Value in current (picked by the engine) layout space.
screen_x The screen space x value of a pointer device, if present.
screen_y The screen space y value of a pointer device, if present.

Thanks to gui.get_width|height and sys.get_config there is workaround. We can calculate multiplier and get values in current layout space.

1 Like