Skip to main content

Basic: touch

touch

import

_ @sys.touch;

touch.ev - touch event handler

touch.ev {
began {
# x,y
};
moved {
# x,y
};
ended {
# x,y
};
};

touch.rect2 - set touch rect

touch.rect2(touch.id, 0,0,w,h);

touch.rect2.lock - set touch rect with lock

touch.rect2.lock(touch.id, 0,0,w,h);

sys.touch.ev.process.run - process touch events

_ @sys.touch.ev.process.run;

Example: touch

sx 0;
sy 0;
dx 0;
dy 0;

pressed r3;
touch.ev {
began {
# x,y
sx:=o2;
sy:=o3;
pressed:=1;
events.push(u0, ui.pool,owner, ui.event.touch.began, o0,o1,o2,o3);
};
moved {
# x,y
dx:=o2-sx;
dy:=o3-sy;
sx:=o2;
sy:=o3;
events.push(u0, ui.pool,owner, ui.event.touch.move, o0,o1,dx,dy);
};
ended {
# x,y
pressed:=0;
events.push(u0, ui.pool,owner, ui.event.touch.end, o0,o1,o2,o3);
};
};

touch.rect2.lock(touch.id, 0,0,w,h);

_ @sys.touch.ev.process.run;