GameMaker device_mouse_x_to_gui question

Gasil

Member
Hello, I'm using:

GML:
xTouch = device_mouse_x_to_gui(0);
yTouch = device_mouse_y_to_gui(0);

//And also tried:

xTouch = device_mouse_x(0);
yTouch = device_mouse_y(0);
I'm drawing them in draw gui. I then create an APK of the test project. In my cellphone, I put my finger on the screen and the coordinates refresh as expected, giving me my finger's coordinates in relation to the screen as I move the finger around.

However I noticed this strange behaviour: there seems to be a 12 or 11 pixel "range radius" from the moment you put your finger on the screen and when you start dragging it across the screen before xTouch and yTouch start updating correctly.

In other words, even if you're legit dragging your finger a little bit on the screen, xTouch and yTouch won't update unless you drag your finger 12 pixels away from the point you initially touched the screen. Weirdly enough, you can override those 12 pixels if you put a finger on the screen already before using another finger to move it around, then device_mouse_x/y_to_gui(1) will update correctly without having to exceed a 12 pixel distance.

Do you know if this is some android limitation, or there can be done something about it in GM2 to override it using solely finger/device 0? I tried messing around with the gesture functions like this:

device_mouse_dbclick_enable(false);
gesture_drag_time(0);
gesture_flick_speed(0);
gesture_drag_distance(0);
gesture_double_tap_time(0);
gesture_tap_count(false)

But they seem to affect nothing regarding that behaviour. It is making reliable touchscreen controls a bit difficult. This has happened in several test devices.

Thank you.
 
Last edited:

Nidoking

Member
I'm not an Android expert, but it sounds like a sort of debouncing to prevent regular taps from registering as gestures. There might be sensitivity settings on the user side, but it's probably an OS limitation. I defer to those with more experience in this, but that's my guess.
 

Gasil

Member
I'm not an Android expert, but it sounds like a sort of debouncing to prevent regular taps from registering as gestures. There might be sensitivity settings on the user side, but it's probably an OS limitation. I defer to those with more experience in this, but that's my guess.
Thanks for your reply, friend. Yes, you're right, after reading you I started fiddling with my phone's developer settings and activated some overlay that shows touch's coordinates and also makes a trail where your finger was dragged around.

It seems it first detects the touch and that 12 pixel padding is some sort of safe zone where the finger can wiggle before it's considered a "dragging" gesture or whatever. I could swipe my finger and then I'd see a red dot where my finger was put on the screen, a blue line representing that safe zone, and a red line when it finally enters "dragging" mode and thus the coordinates start refreshing. Saddly there's no way for game maker to alter that and neither my phone had such an option to alter.

Which is pretty sucky because it messes around with precise virtual analog sticks. Though I downloaded some random games that use a joystick and they all don't seem to have a remedy for that. I suppose it's device dependant too.

I guess I'll live with it, hope users of my app don't destroy me because of "bad controls" if I don't think of a better option for moving the character around lol.

Anyway, I thought you could find this information useful.
 
Last edited:
Top