From Stephan Huber, * GUIEventAdapter: add support for getting normalized touch points

* MultiTouchTrackball: some code cleanup and support for normalized touch-points
* oscdevice: receiving and sending multi-touch-events via the Cursor2D-profile from TUIO
* added some documentation
This commit is contained in:
Robert Osfield
2013-11-18 13:25:55 +00:00
parent d7442e7456
commit e0d3ab4412
11 changed files with 496 additions and 59 deletions

View File

@@ -876,7 +876,7 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
NSTouch *touch = [[allTouches allObjects] objectAtIndex:i];
NSPoint pos = [touch normalizedPosition];
osg::Vec2 pixelPos(pos.x * bounds.size.width, (1-pos.y) * bounds.size.height);
osg::Vec2 pixelPos(pos.x * bounds.size.width, (pos.y) * bounds.size.height);
unsigned int touch_id = [self computeTouchId: touch mayCleanup:FALSE];
if (!osg_event) {
osg_event = _win->getEventQueue()->touchBegan(touch_id, [self convertTouchPhase: [touch phase]], pixelPos.x(), pixelPos.y());
@@ -897,7 +897,7 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
{
NSTouch *touch = [[allTouches allObjects] objectAtIndex:i];
NSPoint pos = [touch normalizedPosition];
osg::Vec2 pixelPos(pos.x * bounds.size.width, (1 - pos.y) * bounds.size.height);
osg::Vec2 pixelPos(pos.x * bounds.size.width, (pos.y) * bounds.size.height);
unsigned int touch_id = [self computeTouchId: touch mayCleanup:FALSE];
if (!osg_event) {
osg_event = _win->getEventQueue()->touchMoved(touch_id, [self convertTouchPhase: [touch phase]], pixelPos.x(), pixelPos.y());
@@ -919,7 +919,7 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
{
NSTouch *touch = [[allTouches allObjects] objectAtIndex:i];
NSPoint pos = [touch normalizedPosition];
osg::Vec2 pixelPos(pos.x * bounds.size.width, (1 - pos.y) * bounds.size.height);
osg::Vec2 pixelPos(pos.x * bounds.size.width, (pos.y) * bounds.size.height);
unsigned int touch_id = [self computeTouchId: touch mayCleanup: TRUE];
if (!osg_event) {
osg_event = _win->getEventQueue()->touchEnded(touch_id, [self convertTouchPhase: [touch phase]], pixelPos.x(), pixelPos.y(), 1);