use of cli.MonoTouch.Foundation.NSSetEnumerator in project playn by threerings.
the class IOSTouch method toTouchEvents.
private Event.Impl[] toTouchEvents(NSSet touches, UIEvent event) {
final Event.Impl[] events = new Event.Impl[Convert.ToInt32(touches.get_Count())];
touches.Enumerate(new NSSetEnumerator(new NSSetEnumerator.Method() {
public void Invoke(NSObject obj, boolean[] stop) {
UITouch touch = (UITouch) obj;
PointF loc = touch.LocationInView(touch.get_View());
// transform the point based on our current scale
IPoint xloc = graphics.transformTouch(loc.get_X(), loc.get_Y());
// on iOS the memory address of the UITouch object is the unique id
int id = touch.get_Handle().ToInt32();
events[_idx++] = new Event.Impl(new Events.Flags.Impl(), touch.get_Timestamp() * 1000, xloc.x(), xloc.y(), id);
stop[0] = false;
}
private int _idx = 0;
}));
return events;
}
use of cli.MonoTouch.Foundation.NSSetEnumerator in project playn by threerings.
the class IOSPointer method toPointerEvent.
private Event.Impl toPointerEvent(NSSet touches, UIEvent event) {
final Event.Impl[] eventw = new Event.Impl[1];
touches.Enumerate(new NSSetEnumerator(new NSSetEnumerator.Method() {
public void Invoke(NSObject obj, boolean[] stop) {
UITouch touch = (UITouch) obj;
int handle = touch.get_Handle().ToInt32();
// if we have an active touch, we only care about that touch
if (_active != 0 && handle != _active) {
stop[0] = false;
} else {
_active = handle;
PointF loc = touch.LocationInView(touch.get_View());
// transform the point based on our current scale
IPoint xloc = graphics.transformTouch(loc.get_X(), loc.get_Y());
eventw[0] = new Event.Impl(new Events.Flags.Impl(), touch.get_Timestamp() * 1000, xloc.x(), xloc.y(), true);
stop[0] = true;
}
}
}));
return eventw[0];
}
Aggregations