device_mouse_raw_x

Returns the x position of the device when pressed.

Syntax:

device_mouse_raw_x(device);


Argument Description
device The device (from 0 - 4) that is being checked.


Returns: Real


Description

This function returns raw x position of the device. What this means is that it returns the actual device definition of the x position that is being touched, not the GameMaker: Studio one, and as such will ignore things like view position and scaling.

Note: This function is very much device dependant and you should experiment first with the desired target module and device to see what exactly is returned.

Example:

if device_mouse_check_button(0, mb_left) && device_mouse_check_button(1, mb_left)
   {
   x_av = mean(device_mouse_raw_x(0), device_mouse_raw_x(1));
   y_av = mean(device_mouse_raw_y(0), device_mouse_raw_y(1));
   }

The above code checks to see if device1 and device2 are being pressed, and if they are it calculates the average position of the x/y coordinates between each press point.


Back: Device Input
Next: device_mouse_raw_y
© Copyright YoYo Games Ltd. 2018 All Rights Reserved