Hi Glenn,

Am 07.02.11 12:06, schrieb Serge Lages:
> I am currently working on getting multi-touch working on Linux with MPX
> (XInput2), and I would like to use this new system for my events. But with
> XInput (or also with Windows 7), I am receiving all the events separately,
> so what's the best approach to feed the
> touchesBegan/touchesMoved/touchesEnded methods ? Will I need to store each
> input state internally into the GraphicWindow class to set each time all the
> touch states ?

You'll have to store your touch-points and submit them alltogether as
one event to the eventqueue, here's some pseudo-code:

osg::ref_ptr<osgGA::GUIEventAdapter> osg_event(NULL);
for(int i = 0; i < numTouches; i++)
{
  // get touch i and corrsponding phase, x and y
  ...
  // feed it to the osg_event
  if (!osg_event) {
    osg_event = _win->getEventQueue()->touchBegan(i, phase, x, y);
  } else {
    osg_event->addTouchPoint(i, phase, x, y);
  }     
}

As Paul noticed in one of his recent mails, the design of the current
implementation is not the easiest and cleanest,  but I was happy to have
something working on my end. So if you have any improvements to the
design/code, please share them with us, so we get a robust and clean
multi-touch implementation working consistent on different platforms.

cheers,
Stephan
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to