Device Input

This section deals with multi touch input for devices.

When your game is being targeted at those platforms that permit multi-touch, you should be using these functions. They work the same way a PC would work if it had multiple mice attached and the constants that are being checked for are the same as those used for the standard mouse functions:

Constant Description
mb_left The left mouse button
mb_middle The middle mouse button (this may not be valid for all target platforms)
mb_right The right mouse button
mb_none No mouse button
mb_any Any of the mouse buttons

NOTE: On touch screen devices, a double tap is returned as the equivalent of a right mouse button event. So, if you need to detect multiple taps in quick succession, for example, you will need to check for both the mb_left and mb_right. This functionality can be toggled on or off using device_mouse_dbclick_enable.

Below you can find a list of all the device specific control functions:

  1. device_mouse_check_button
  2. device_mouse_check_button_pressed
  3. device_mouse_check_button_released
  4. device_mouse_dbclick_enable
  5. device_mouse_x
  6. device_mouse_y
  7. device_mouse_raw_x
  8. device_mouse_raw_y
  9. device_mouse_x_to_gui
  10. device_mouse_y_to_gui
  11. device_is_keypad_open
  12. device_get_tilt_x
  13. device_get_tilt_y
  14. device_get_tilt_z

Please note that on mobile devices (Android, iOS), you can use the back button at any time, as it is mapped to the keyboard backspace which is the GameMaker: Studio keyboard constant vk_backspace, so you can do checks for that key and perform actions on those devices as if the back button had been used.

Back: Mouse, Keyboard and Other Controls
© Copyright YoYo Games Ltd. 2018 All Rights Reserved