HI Francesco,
osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON isn't an event type, so you
can comparing two different types and not surprisingly getting the
wrong result.
Instead you should use the PUSH and RELEASE event types, within the
switch to find out when buttons are pressed or released, then within
each block check which button is pressed using event.getButton().
Once corrected your event handling code will work in OSG-1.x and OSG-2.x.
Robert.
On Tue, Dec 9, 2008 at 11:45 AM, Francesco Argese <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have written an application based on osgart 1.0 (that uses
> OpenScenegraph 1.2) and i'm trying to add mouse event support. To do
> so i have written a class derived from osgGA::GUIEventHandler and
> added the event Handler to the viewer.
>
> The handle works but i have noted some problems with events
> RIGHT_MOUSE_BUTTON and LEFT_MOUSE_BUTTON that don't work as i expect.
> Others events, such asPUSH, works very well. In particular when i
> launch the application the result is a wrong interpretation of the
> events. I have understood this problem with the following simple code
> in the "handle()"'s body:
>
> int event = ea.getEventType();
>
> switch(event)
> {
> case osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON:
> printf("Evento PUSH generato\n");
> break;
> case osgGA::GUIEventAdapter::RIGHT_MOUSE_BUTTON:
> printf("Evento RIGHT_MOUSE_BUTTON generato\n");
> break;
> }
>
> It prints wrong results using the mouse.
>
> Is this a known problem with 1.2 version? Or have i done some errors
> using the library?
>
> Thanks in advance
> Francesco Argese
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org