device_mouse_check_button

This function returns true or false depending on whether the given mouse button is being held down on the given device. For the mouse button you can supply one of the constants listed on this page.

This function can be used for touch screens, and the device argument can be from 0 to n where n is the maximum number of "fingers" that can be touching the screen at once (the maximum number of touches that can be detected will depend very much on the device being used and the OS it runs, but most devices should detect at least up to 4). Note that mb_right will only be detected if a double tap touch is detected (this behavior can be disabled using the function device_mouse_dbclick_enable()).

 

Syntax:

device_mouse_check_button(device, button);

ArgumentType Description
deviceReal The device (from 0 - n) that is being checked
buttonMouse Button Constant The button of the device that is being checked.

 

Returns:

Boolean

 

Example:

if device_mouse_check_button(0, mb_left) && device_mouse_check_button(1, mb_left)
{
    room_goto(rm_Menu);
}

The above code checks to see if the two touches are being held down at the same time and if they then it goes to another room.