So how does YoYo_Mouse... actually work?
#1
Posted 27 March 2012 - 12:32 PM
So how does the YoYo_Mouse functions actually work?
All I know is that they allow for multi touch. Could someone educate me on these functions?
I'd really appreciate it as we're looking towards the porting of The New Dawn.
#2
Posted 27 March 2012 - 01:17 PM
When you touch your mobile's screen, that will register as device 0. If you touch with another finger while still touching with the first, the second will be device 1. Using these functions, you can check positions, downstates etc of up to five fingers.
So for example, with a simple for loop, you can check whether an enemy with object index oEnemy is being tapped on by any of up to five presses, and destroy it if it is:
for(i=0;i<=4;i+=1)
{
if YoYo_MouseCheckButtonPressed(i,mb_left)
{
p=collision_point(YoYo_MouseX(i),YoYo_MouseY(i),
oEnemy,0,0)
if p>-1
{
with(p) instance_destroy()
}
}
}
Edited by NAL, 27 March 2012 - 01:18 PM.
#3
Posted 27 March 2012 - 02:37 PM
for(device=0;device<=4;device+=1){
if (YoYo_MouseCheckButton(device,mb_left)){
//stuff to do if screen touched goes HERE! //of course, device can be changed to any variable if you want!
}
}
#4
Posted 27 March 2012 - 03:37 PM
#5
Posted 27 March 2012 - 03:55 PM
When you touch your mobile's screen, that will register as device 0. If you touch with another finger while still touching with the first, the second will be device 1.
What happens if you then remove the first finger before the second? Does device 1 become 0, or does the next touch become 0, and then the following 2, if 1 is still pressed?
#6
Posted 27 March 2012 - 09:14 PM
Just use device 0, or simpler, use GM's standard in-built mouse functions. Every mouse function should work with the first touch fine.Ah that makes sense. Though what happens if you only want single touch?
What happens if you then remove the first finger before the second? Does device 1 become 0, or does the next touch become 0, and then the following 2, if 1 is still pressed?
Device 1 will remain Device 1 rather than revert to 0, etc.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











