Multi Touch on iOS

TheOnlyWRT

Member
Hey, so ive got a few more questions about iOS programming;

How do i read multiple touches? ive read up about device_mouse_check and i have drawn the variables to see that it does in fact read multiple touches.

in my project i have a vstick on the left of the screen, and three buttons on the right. The first touch may be either the vstick or the buttons, or vice versa. So, i need to be reading both device 0 and 1 at both spots, but once one is pressed, i only need to read the other device. How can i do that?

Thanks a ton!
 
Last edited:

PNelly

Member
You might just check the position or gui position of each touch before executing the button action

Code:
var _device, _gui_x, _gui_y, _pressed, active;
for(_device = 0; _device < 5; _device++){ // allows 5 simultaneous touches

     _gui_x = device_mouse_x_to_gui(_device);
     _gui_y = device_mouse_y_to_gui(_device);
     _pressed = device_mouse_check_button_pressed(_device, mb_left);
     _active = device_mouse_check_button(_device, mb_left);

     if( _gui_x > vstick_x_min && _gui_x < vstick_x_max
     && _gui_y > vstick_y_min && _gui_y < vstick_y_max
     && _active){

          // do vstick stuff

     } else if( _gui_x > button1_x_min && _gui_x < button1_x_max
     && _gui_y > button1_y_min && _gui_y < button1_y_max
     && _pressed){

          // do button 1 stuff

     }

     // continue for other buttons...

}
 
Top