mimusic
Member
I'm working on a custom touchscreen extension to use with my GMS projects when exporting them through HTML5 but I've run into a strange set of issues. My intention is to track the position of each finger within a resolution-defined layer that acts like a GUI layer, but Device 0 is returning coordinates differently than Device 1, 2, ... Device N. To summarize the issues:
Worst comes to worst, I'll just trigger the touch events in JS and send that info back to GMS via extension, but I would really rather not have to do that just because something isn't behaving as expected. If it's confirmed that the functions are indeed working incorrectly, I'll report the bug properly.
Any help on this issue is greatly appreciated!
- - - - -
Images demonstrating the issues:
white circles are where GM thinks the input is. Green blobs are (roughly) where I was actually touching the screen. Transparent green lines are drawn to show which blob corresponds to which circle.
- device_mouse_x/y are the only functions that behave consistently across all inputs, which isn't a viable option because this variable is dependent upon view properties like location, scale, etc...
- device_mouse_x/y_to_gui works for input 0, but anything beyond that is awkwardly translated, as if the input coords are not scaling with the layer, despite the GUI itself having a defined resolution. Strangely, when an input begins on the canvas/viewport and is dragged off, it's correct when it's off the canvas. Realistically, this is the function I should be able to rely on just giving me coordinates relative to [0,0] on the GUI layer. This is the one I would really like an explanation for.
- device_mouse_raw_x/y are not working independent of the view. Tested on a game where I'm using a 3D camera vs a game where I have a stationary 2D camera, and even though the code used is exactly the same, the input coordinate behavior differs. Perhaps I'm misunderstanding the docs when claiming that this function is independent of view and scaling, but either way this is once again a case where the first input device works differently from all devices after. First input works as expected.
Worst comes to worst, I'll just trigger the touch events in JS and send that info back to GMS via extension, but I would really rather not have to do that just because something isn't behaving as expected. If it's confirmed that the functions are indeed working incorrectly, I'll report the bug properly.
Any help on this issue is greatly appreciated!
- - - - -
Images demonstrating the issues:
white circles are where GM thinks the input is. Green blobs are (roughly) where I was actually touching the screen. Transparent green lines are drawn to show which blob corresponds to which circle.